Skip to content

Commit

Permalink
Add version
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Mar 3, 2024
1 parent c467ea8 commit 0fd9a31
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/ethernaut-cli/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require('dotenv').config({
path: require('path').resolve(__dirname, '../../.env'),
})
const figlet = require('figlet')
const { version } = require('./package.json')

require('ethernaut-challenges')
require('ethernaut-ai')
Expand All @@ -14,6 +16,11 @@ require('ethernaut-network-ui')
require('ethernaut-wallet')
require('ethernaut-wallet-ui')

const fonts = figlet.fontsSync()
const font = fonts[Math.floor(Math.random() * fonts.length)]
console.log(figlet.textSync('EthernautCLI', { font }))
console.log(`v${version}`)

module.exports = {
solidity: '0.8.19',
defaultNetwork: 'localhost',
Expand Down
1 change: 1 addition & 0 deletions packages/ethernaut-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
"dependencies": {
"dotenv": "^16.4.1",
"figlet": "^1.7.0",
"hardhat": "^2.19.4"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/ethernaut-cli/test/scopes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ describe('scopes', function () {
assert.notEqual(hre.scopes['util'], undefined)
})

it('has an "challenges" scope', async function () {
it('has a "challenges" scope', async function () {
assert.notEqual(hre.scopes['challenges'], undefined)
})

it('has a "ui" scope', async function () {
assert.notEqual(hre.scopes['ui'], undefined)
it('doesnt have a "vars" scope', async function () {
assert.equal(hre.scopes['vars'], undefined)
})

it('doesnt have a "poop" scope', async function () {
Expand Down
16 changes: 16 additions & 0 deletions packages/ethernaut-cli/test/version.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { version } = require('../package.json')
const { Terminal } = require('common/src/terminal')

describe('version', function () {
const terminal = new Terminal()

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

it('shows version', async function () {
terminal.has(`v${version}`)
})
})
})

0 comments on commit 0fd9a31

Please sign in to comment.