Skip to content

Commit

Permalink
no npx hardhat in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Apr 1, 2024
1 parent a8da614 commit e11c83a
Show file tree
Hide file tree
Showing 36 changed files with 57 additions and 60 deletions.
2 changes: 1 addition & 1 deletion packages/ethernaut-ai-ui/test/tasks/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('config ui', function () {

describe('when config is called with no params', function () {
before('call', async function () {
await terminal.run('npx hardhat ai config', 2000)
await terminal.run('hardhat ai config', 2000)
})

it('displays gpt models', async function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-ai/test/tasks/interpret.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe.skip('interpret', function () {
describe('without prompting', function () {
before('call interpret', async function () {
await terminal.run(
'npx hardhat ai interpret "what is SNX in bytes?" --no-confirm --new-thread --model \'gpt-3.5-turbo\'',
'hardhat ai interpret "what is SNX in bytes?" --no-confirm --new-thread --model \'gpt-3.5-turbo\'',
60000,
)
})
Expand All @@ -30,7 +30,7 @@ describe.skip('interpret', function () {
describe('with prompting', function () {
before('run interpret', async function () {
await terminal.run(
'npx hardhat ai interpret "what is SNX in bytes?" --new-thread --model \'gpt-3.5-turbo\'',
'hardhat ai interpret "what is SNX in bytes?" --new-thread --model \'gpt-3.5-turbo\'',
30000,
)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-cli/test/navigate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('navigation', function () {

describe('when navigating the root scope', function () {
before('nav', async function () {
await terminal.run('npx hardhat', 2000)
await terminal.run('hardhat', 2000)
})

it('shows the expected scopes', async function () {
Expand Down Expand Up @@ -37,7 +37,7 @@ describe('navigation', function () {

describe('when navigating the network scope', function () {
before('nav', async function () {
await terminal.run('npx hardhat network', 2000)
await terminal.run('hardhat network', 2000)
})

it('displays all tasks', async function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-cli/test/telemetry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('telemetry', function () {
})

before('start cli', async function () {
await terminal.run('npx hardhat', 2000)
await terminal.run('hardhat', 2000)
})

it('displays the telemetry consent prompt', async function () {
Expand All @@ -48,7 +48,7 @@ describe('telemetry', function () {
})

before('start cli', async function () {
await terminal.run('npx hardhat', 2000)
await terminal.run('hardhat', 2000)
})

it('does not display the telemetry consent prompt', async function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-cli/test/update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe('update', function () {

async function triggerUpdate() {
// Twice because this is how update notifications work
await terminal.run('npx hardhat', 2000)
await terminal.run('npx hardhat', 3000)
await terminal.run('hardhat', 2000)
await terminal.run('hardhat', 3000)
}

before('cache', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-cli/test/version.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('version', function () {

describe('when calling any command', function () {
before('call', async function () {
await terminal.run('npx hardhat util unit 1 from --ether to --wei')
await terminal.run('hardhat util unit 1 from --ether to --wei')
})

it('shows version', async function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-interact/test/tasks/balance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('balance', function () {
})

before('make call', async function () {
await terminal.run(`npx hardhat interact balance ${signer.address}`)
await terminal.run(`hardhat interact balance ${signer.address}`)
})

it('shows the address', async function () {
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('balance', function () {
before('make call', async function () {
const token = await contract.getAddress()
await terminal.run(
`npx hardhat interact balance ${signer.address} --token ${token}`,
`hardhat interact balance ${signer.address} --token ${token}`,
)
})

Expand Down
8 changes: 4 additions & 4 deletions packages/ethernaut-interact/test/tasks/contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('contract', function () {

before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn incrementCounter --params 42`,
`hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn incrementCounter --params 42`,
)
})

Expand All @@ -111,15 +111,15 @@ describe('contract', function () {

it('incremented the counter', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn counter --params ''`,
`hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn counter --params ''`,
)
terminal.has('counter() => 42')
})

describe('and then decrementing it', function () {
before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn decrementCounter --params 42`,
`hardhat interact contract --address ${await sample.getAddress()} --no-confirm --abi ${abiPath} --fn decrementCounter --params 42`,
)
})

Expand All @@ -136,7 +136,7 @@ describe('contract', function () {

before('run contract', async function () {
await terminal.run(
`npx hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn incrementCounter --params 42`,
`hardhat interact contract --address ${await sample.getAddress()} --abi ${abiPath} --fn incrementCounter --params 42`,
5000,
)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-interact/test/tasks/logs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('logs', function () {
describe('when finding logs', function () {
before('use cli', async function () {
await terminal.run(
`npx hardhat interact logs --address ${await token.getAddress()} --abi artifacts/contracts/TestToken.sol/TestToken.json --event Transfer --params ''`,
`hardhat interact logs --address ${await token.getAddress()} --abi artifacts/contracts/TestToken.sol/TestToken.json --event Transfer --params ''`,
)
})

Expand Down
4 changes: 2 additions & 2 deletions packages/ethernaut-interact/test/tasks/send.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('send', function () {

before('run send', async function () {
await terminal.run(
`npx hardhat interact send --address ${signer2.address} --value 1 --no-confirm`,
`hardhat interact send --address ${signer2.address} --value 1 --no-confirm`,
)
})

Expand All @@ -83,7 +83,7 @@ describe('send', function () {

before('run send', async function () {
await terminal.run(
`npx hardhat interact send --address ${signer2.address} --value 1`,
`hardhat interact send --address ${signer2.address} --value 1`,
5000,
)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-interact/test/tasks/token.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('contract', function () {
describe('when reading the token name', function () {
before('run contract', async function () {
await terminal.run(
`npx hardhat interact token ${await token.getAddress()} --no-confirm --fn name --params ''`,
`hardhat interact token ${await token.getAddress()} --no-confirm --fn name --params ''`,
)
})

Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network-ui/test/tasks/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('add ui', function () {

describe('when provider is missing', function () {
before('run add', async function () {
await terminal.run('npx hardhat network add test__2', 2000)
await terminal.run('hardhat network add test__2', 2000)
})

it('suggests strategies', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network-ui/test/tasks/edit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('edit ui', function () {

describe('when parameters are missing', function () {
before('run edit', async function () {
await terminal.run('npx hardhat network edit', 2000)
await terminal.run('hardhat network edit', 2000)
})

it('suggests networks', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network-ui/test/tasks/node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('node ui', function () {

describe('when parameters are not provided', function () {
before('run', async function () {
await terminal.run('npx hardhat network node', 2000)
await terminal.run('hardhat network node', 2000)
})

it('queries for a network to fork', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network-ui/test/tasks/remove.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('remove ui', function () {

describe('when alias is missing', function () {
before('run remove', async function () {
await terminal.run('npx hardhat network remove', 2000)
await terminal.run('hardhat network remove', 2000)
})

it('suggests networks', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('add', function () {

before('run add', async function () {
await terminal.run(
'npx hardhat network add test__1 --url http://localhost:8545',
'hardhat network add test__1 --url http://localhost:8545',
)
})

Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/current.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('current', function () {

describe('when calling active task', function () {
before('call task', async function () {
await terminal.run('npx hardhat network current')
await terminal.run('hardhat network current')
})

it('prints the active network', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/edit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('edit', function () {
})

before('run edit', async function () {
await terminal.run('npx hardhat network edit test__3 --url poop2')
await terminal.run('hardhat network edit test__3 --url poop2')
})

it('edits the network', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('info', function () {

describe('when specifying an alias', function () {
before('query', async function () {
await terminal.run('npx hardhat network info test__mainnet', 5000)
await terminal.run('hardhat network info test__mainnet', 5000)
})

it('shows the expected results', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('list', function () {

describe('when calling list', function () {
before('call', async function () {
await terminal.run('npx hardhat network list')
await terminal.run('hardhat network list')
})

it('prints the networks', async function () {
Expand Down
7 changes: 2 additions & 5 deletions packages/ethernaut-network/test/tasks/node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ describe('node', function () {
describe('when parameters are provided', function () {
describe('with none', function () {
before('run', async function () {
await terminal.run(
'npx hardhat network node --fork none --port 8547',
2000,
)
await terminal.run('hardhat network node --fork none --port 8547', 2000)
})

it('starts a local chain', async function () {
Expand All @@ -48,7 +45,7 @@ describe('node', function () {

before('run', async function () {
await terminal.run(
'npx hardhat network node --fork test__mainnet --port 8547',
'hardhat network node --fork test__mainnet --port 8547',
5000,
)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/remove.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('remove', function () {
})

before('run remove', async function () {
await terminal.run('npx hardhat network remove test__3')
await terminal.run('hardhat network remove test__3')
})

it('removes the network', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-network/test/tasks/set.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('set', function () {

describe('when calling set', function () {
before('call set', async function () {
await terminal.run('npx hardhat network set test__1', 2000)
await terminal.run('hardhat network set test__1', 2000)
})

it('sets the active network', async function () {
Expand Down
12 changes: 6 additions & 6 deletions packages/ethernaut-ui/test/tasks/help.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('help', function () {

describe('when entering the cli with no arguments', function () {
before('run hardhat', async function () {
await terminal.run('npx hardhat', 2500)
await terminal.run('hardhat', 2500)
})

it('displays the main prompt', async function () {
Expand All @@ -23,7 +23,7 @@ describe('help', function () {

describe('when entering the cli with just a scope', function () {
before('run hardhat', async function () {
await terminal.run('npx hardhat util', 2500)
await terminal.run('hardhat util', 2500)
})

it('displays the main prompt', async function () {
Expand All @@ -48,7 +48,7 @@ describe('help', function () {

describe('with the explicit help task', function () {
before('run command', async function () {
await terminal.run('npx hardhat help')
await terminal.run('hardhat help')
})

itShowsHelp()
Expand All @@ -60,7 +60,7 @@ describe('help', function () {

describe('with no scope or task', function () {
before('run command', async function () {
await terminal.run('npx hardhat --help')
await terminal.run('hardhat --help')
})

itShowsHelp()
Expand All @@ -72,15 +72,15 @@ describe('help', function () {

describe('with a scope', function () {
before('run command', async function () {
await terminal.run('npx hardhat util --help')
await terminal.run('hardhat util --help')
})

itShowsHelp()
})

describe('with a task', function () {
before('run command', async function () {
await terminal.run('npx hardhat util unit --help')
await terminal.run('hardhat util unit --help')
})

itShowsHelp()
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-ui/test/tasks/navigate-scope.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('navigate scope', function () {

describe('when entering navigation at a particular scope', function () {
before('run navigate util', async function () {
await terminal.run('npx hardhat navigate util', 2500)
await terminal.run('hardhat navigate util', 2500)
})

it('displays the main prompt', async function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethernaut-ui/test/tasks/navigate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('navigate', function () {

describe('when entering navigation', function () {
before('run navigate', async function () {
await terminal.run('npx hardhat navigate', 2500)
await terminal.run('hardhat navigate', 2500)
})

it('displays the main prompt', async function () {
Expand Down
Loading

0 comments on commit e11c83a

Please sign in to comment.