Skip to content

Commit

Permalink
test: add a test for the version command (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
lholmquist authored and richardlau committed Oct 31, 2019
1 parent 1fc0d9c commit 2f62ad9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/cli-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,24 @@ test('Test cli flags', (t) => {
})
})

t.test('test version flag', (tt) => {
const ls = spawn('./bin/cmd.js', ['--version'])
let compiledData = ''
ls.stdout.on('data', (data) => {
compiledData += data
})

ls.stderr.on('data', (data) => {
tt.fail('This should not happen')
})

ls.on('close', (code) => {
tt.equal(compiledData.trim(),
`core-validate-commit v${require('../package.json').version}`,
'output is equal')
tt.end()
})
})

t.end()
})

0 comments on commit 2f62ad9

Please sign in to comment.