Skip to content

Commit

Permalink
Add dummy test for executing a script
Browse files Browse the repository at this point in the history
A simple test to see if application's exit code, stdout and stderr can be captured.
  • Loading branch information
aedart committed Oct 16, 2024
1 parent 1ed1558 commit 95a38e5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/cli/tmp.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, it } from 'node:test';
import * as assert from "node:assert";
import { exec } from "node:child_process"

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

it('can invoke cli application via npx', async () => {
return exec('npx ion', (error, stdout,stderr) => {
// console.log('stdout', stdout);
// console.error('stderr', stderr);
// console.log('code', error.code);

assert.equal(error.code, 1, `Incorrect exit code: (${error.code})`);
});
});
});

0 comments on commit 95a38e5

Please sign in to comment.