Skip to content

Commit

Permalink
Add test for invoking via npx
Browse files Browse the repository at this point in the history
Also, this replaces the previous tmp.test.js
  • Loading branch information
aedart committed Nov 2, 2024
1 parent 61a945d commit 58db8e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
26 changes: 26 additions & 0 deletions tests/cli/packages/cli/bin/npx.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { describe, it } from 'node:test';
import * as assert from "node:assert";
import { exec } from "node:child_process"

describe('@aedart/cli', () => {

describe('bin', () => {

describe('npx', () => {

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.ok(error === null, `Error encountered from Cli Application: ${error?.message}`);
assert.ok(stdout.length !== 0, 'Cli application failed to output default "help"');
}).on('exit', (code) => {
const expected = 0;
assert.equal(code, expected, `Expected exist code ${expected}, but received: ${code} from cli application`);
});
});
});
});
});
23 changes: 0 additions & 23 deletions tests/cli/tmp.test.js

This file was deleted.

0 comments on commit 58db8e5

Please sign in to comment.