Skip to content

Commit 20081e6

Browse files
Jake ChampionJakeChampion
authored andcommitted
add test for --version and -V flags
1 parent 917e7a2 commit 20081e6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

integration-tests/cli/version.test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import test from 'brittle';
2+
import { getBinPath } from 'get-bin-path'
3+
import { prepareEnvironment } from '@gmrchk/cli-testing-library';
4+
5+
const cli = await getBinPath()
6+
7+
test('--version should return version number on stdout and zero exit code', async function (t) {
8+
const { execute, cleanup } = await prepareEnvironment();
9+
t.teardown(async function () {
10+
await cleanup();
11+
});
12+
const { code, stdout, stderr } = await execute('node', `${cli} --version`);
13+
14+
t.is(code, 0);
15+
t.alike(stdout, ['js-compute-runtime 0.5.4'])
16+
t.alike(stderr, [])
17+
});
18+
19+
test('-V should return version number on stdout and zero exit code', async function (t) {
20+
const { execute, cleanup } = await prepareEnvironment();
21+
t.teardown(async function () {
22+
await cleanup();
23+
});
24+
const { code, stdout, stderr } = await execute('node', `${cli} -V`);
25+
26+
t.is(code, 0);
27+
t.alike(stdout, ['js-compute-runtime 0.5.4'])
28+
t.alike(stderr, [])
29+
});

0 commit comments

Comments
 (0)