Skip to content

Commit 95a38e5

Browse files
committed
Add dummy test for executing a script
A simple test to see if application's exit code, stdout and stderr can be captured.
1 parent 1ed1558 commit 95a38e5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/cli/tmp.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, it } from 'node:test';
22
import * as assert from "node:assert";
3+
import { exec } from "node:child_process"
34

45
/**
56
* TODO: Testing nodejs - dummy file to be removed again!
@@ -10,4 +11,13 @@ describe('TODO', () => {
1011
assert.ok(true);
1112
});
1213

14+
it('can invoke cli application via npx', async () => {
15+
return exec('npx ion', (error, stdout,stderr) => {
16+
// console.log('stdout', stdout);
17+
// console.error('stderr', stderr);
18+
// console.log('code', error.code);
19+
20+
assert.equal(error.code, 1, `Incorrect exit code: (${error.code})`);
21+
});
22+
});
1323
});

0 commit comments

Comments
 (0)