Skip to content

Commit 2f62ad9

Browse files
lholmquistrichardlau
authored andcommitted
test: add a test for the version command (#78)
1 parent 1fc0d9c commit 2f62ad9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: test/cli-test.js

+19
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,24 @@ test('Test cli flags', (t) => {
4040
})
4141
})
4242

43+
t.test('test version flag', (tt) => {
44+
const ls = spawn('./bin/cmd.js', ['--version'])
45+
let compiledData = ''
46+
ls.stdout.on('data', (data) => {
47+
compiledData += data
48+
})
49+
50+
ls.stderr.on('data', (data) => {
51+
tt.fail('This should not happen')
52+
})
53+
54+
ls.on('close', (code) => {
55+
tt.equal(compiledData.trim(),
56+
`core-validate-commit v${require('../package.json').version}`,
57+
'output is equal')
58+
tt.end()
59+
})
60+
})
61+
4362
t.end()
4463
})

0 commit comments

Comments
 (0)