Skip to content

Commit

Permalink
test: add -test.(c|m)js test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarchini committed Sep 10, 2024
1 parent 14d1cbc commit a052c0b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/fixtures/test-runner/matching-patterns/index-test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';
const test = require('node:test');

test('this should pass');
4 changes: 4 additions & 0 deletions test/fixtures/test-runner/matching-patterns/index-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';
const test = require('node:test');

test('this should pass');
4 changes: 4 additions & 0 deletions test/fixtures/test-runner/matching-patterns/index-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';
import test from 'node:test';

test('this should pass');
16 changes: 16 additions & 0 deletions test/parallel/test-runner-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ for (const isolation of ['none', 'process']) {
assert.match(stdout, /ok 6 - this should be executed/);
}

{
// Should match files with "-test.(c|m)js" suffix.
const args = ['--test', '--test-reporter=tap',
`--experimental-test-isolation=${isolation}`];
const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'matching-patterns') });

assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stderr.toString(), '');
const stdout = child.stdout.toString();

assert.match(stdout, /ok 1 - this should pass/);
assert.match(stdout, /ok 2 - this should pass/);
assert.match(stdout, /ok 3 - this should pass/);
}

{
// Same but with a prototype mutation in require scripts.
const args = [
Expand Down

0 comments on commit a052c0b

Please sign in to comment.