GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_runner: update kPatterns · nodejs/node@6552fdd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • utils.js
  • test
    • fixtures/test-runner
      • issue-54726
        • latest.js
        • non-matching.js
      • matching-patterns
        • index-test.cjs
        • index-test.js
        • index-test.mjs
    • parallel
      • test-runner-cli.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const coverageColors = {
5151
const kMultipleCallbackInvocations = 'multipleCallbackInvocations';
5252
const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
5353

54-
const kPatterns = ['test', 'test/**/*', 'test-*', '*[.-_]test'];
54+
const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
5555
const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.?(c|m)js`;
5656

5757

Collapse file

‎test/fixtures/test-runner/issue-54726/latest.js‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/issue-54726/latest.js
Whitespace-only changes.
Collapse file

‎test/fixtures/test-runner/issue-54726/non-matching.js‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/issue-54726/non-matching.js
Whitespace-only changes.
Collapse file

‎test/fixtures/test-runner/matching-patterns/index-test.cjs‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
const test = require('node:test');
3+
4+
test('this should pass');
Collapse file

‎test/fixtures/test-runner/matching-patterns/index-test.js‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
const test = require('node:test');
3+
4+
test('this should pass');
Collapse file

‎test/fixtures/test-runner/matching-patterns/index-test.mjs‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
import test from 'node:test';
3+
4+
test('this should pass');
Collapse file

‎test/parallel/test-runner-cli.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-runner-cli.js
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ for (const isolation of ['none', 'process']) {
4343
assert.match(stdout, /ok 6 - this should be executed/);
4444
}
4545

46+
{
47+
// Should match files with "-test.(c|m)js" suffix.
48+
const args = ['--test', '--test-reporter=tap',
49+
`--experimental-test-isolation=${isolation}`];
50+
const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'matching-patterns') });
51+
52+
assert.strictEqual(child.status, 0);
53+
assert.strictEqual(child.signal, null);
54+
assert.strictEqual(child.stderr.toString(), '');
55+
const stdout = child.stdout.toString();
56+
57+
assert.match(stdout, /ok 1 - this should pass/);
58+
assert.match(stdout, /ok 2 - this should pass/);
59+
assert.match(stdout, /ok 3 - this should pass/);
60+
}
61+
4662
{
4763
// Same but with a prototype mutation in require scripts.
4864
const args = [
@@ -361,3 +377,22 @@ for (const isolation of ['none', 'process']) {
361377
assert.match(stdout, /# fail 0/);
362378
assert.match(stdout, /# skipped 0/);
363379
}
380+
381+
{
382+
// Should not match files like latest.js
383+
const args = ['--test', '--test-reporter=tap'];
384+
const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'issue-54726') });
385+
386+
assert.strictEqual(child.status, 0);
387+
assert.strictEqual(child.signal, null);
388+
assert.strictEqual(child.stderr.toString(), '');
389+
const stdout = child.stdout.toString();
390+
391+
assert.match(stdout, /tests 0/);
392+
assert.match(stdout, /suites 0/);
393+
assert.match(stdout, /pass 0/);
394+
assert.match(stdout, /fail 0/);
395+
assert.match(stdout, /cancelled 0/);
396+
assert.match(stdout, /skipped 0/);
397+
assert.match(stdout, /todo 0/);
398+
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.