Skip to content

Commit

Permalink
test: node test runner (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Oct 23, 2022
1 parent d5b62b7 commit 5d8cc04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/fixtures/test-runner-file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { test } from 'node:test';
import assert from 'assert';

test('passing test', () => {
assert.strictEqual(1, 1);
});
14 changes: 13 additions & 1 deletion tests/specs/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tsx, tsxPath } from '../utils/tsx';
import { ptyShell, isWindows } from '../utils/pty-shell';

export default testSuite(({ describe }, fixturePath: string) => {
describe('CLI', ({ describe }) => {
describe('CLI', ({ describe, test }) => {
describe('version', ({ test }) => {
test('shows version', async () => {
const tsxProcess = await tsx({
Expand Down Expand Up @@ -56,6 +56,18 @@ export default testSuite(({ describe }, fixturePath: string) => {
});
});

test('Node.js test runner', async () => {
const tsxProcess = await tsx({
args: [
'--test',
path.join(fixturePath, 'test-runner-file.ts'),
],
});

expect(tsxProcess.stdout).toMatch('# pass 1\n');
expect(tsxProcess.exitCode).toBe(0);
}, 10_000);

describe('Relays kill signal', ({ test }) => {
const signals = ['SIGINT', 'SIGTERM'];

Expand Down

0 comments on commit 5d8cc04

Please sign in to comment.