Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5054fc7

Browse filesBrowse files
marco-ippolitotargos
authored andcommitted
test_runner: change ts default glob
PR-URL: #57359 Fixes: #56546 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 3dc3207 commit 5054fc7
Copy full SHA for 5054fc7

File tree

Expand file treeCollapse file tree

6 files changed

+7
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+7
-10
lines changed
Open diff view settings
Collapse file

‎doc/api/test.md‎

Copy file name to clipboardExpand all lines: doc/api/test.md
+3-6Lines changed: 3 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,9 @@ By default, Node.js will run all files matching these patterns:
423423
Unless [`--no-experimental-strip-types`][] is supplied, the following
424424
additional patterns are also matched:
425425

426-
* `**/*.test.{cts,mts,ts}`
427-
* `**/*-test.{cts,mts,ts}`
428-
* `**/*_test.{cts,mts,ts}`
429-
* `**/test-*.{cts,mts,ts}`
430-
* `**/test.{cts,mts,ts}`
431-
* `**/test/**/*.{cts,mts,ts}`
426+
* `**/test/**/*-test.{cts,mts,ts}`
427+
* `**/test/**/*.test.{cts,mts,ts}`
428+
* `**/test/**/*_test.{cts,mts,ts}`
432429

433430
Alternatively, one or more glob patterns can be provided as the
434431
final argument(s) to the Node.js command, as shown below.
Collapse file

‎lib/internal/test_runner/runner.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/runner.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let kResistStopPropagation;
108108
function createTestFileList(patterns, cwd) {
109109
const hasUserSuppliedPattern = patterns != null;
110110
if (!patterns || patterns.length === 0) {
111-
patterns = [kDefaultPattern];
111+
patterns = kDefaultPattern;
112112
}
113113
const glob = new Glob(patterns, {
114114
__proto__: null,
Collapse file

‎lib/internal/test_runner/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
5555

5656
const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
5757
const kFileExtensions = ['js', 'mjs', 'cjs'];
58+
const kDefaultPattern = [`**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`];
5859
if (getOptionValue('--experimental-strip-types')) {
59-
ArrayPrototypePush(kFileExtensions, 'ts', 'mts', 'cts');
60+
ArrayPrototypePush(kDefaultPattern, '**/test/**/*{-,.,_}test.{cts,mts,ts}');
6061
}
61-
const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`;
6262

6363
function createDeferredCallback() {
6464
let calledCount = 0;
@@ -290,7 +290,7 @@ function parseCommandLine() {
290290
if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) {
291291
// TODO(pmarchini): this default should follow something similar to c8 defaults
292292
// Default exclusions should be also exported to be used by other tools / users
293-
coverageExcludeGlobs = [kDefaultPattern];
293+
coverageExcludeGlobs = kDefaultPattern;
294294
}
295295
coverageIncludeGlobs = getOptionValue('--test-coverage-include');
296296

Collapse file

‎…er/matching-patterns/typescript-test.cts‎ ‎…tching-patterns/test/typescript-test.cts‎test/fixtures/test-runner/matching-patterns/typescript-test.cts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.cts test/fixtures/test-runner/matching-patterns/typescript-test.cts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.cts

Copy file name to clipboard
File renamed without changes.
Collapse file

‎…er/matching-patterns/typescript-test.mts‎ ‎…tching-patterns/test/typescript-test.mts‎test/fixtures/test-runner/matching-patterns/typescript-test.mts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.mts test/fixtures/test-runner/matching-patterns/typescript-test.mts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.mts

Copy file name to clipboard
File renamed without changes.
Collapse file

‎…ner/matching-patterns/typescript-test.ts‎ ‎…atching-patterns/test/typescript-test.ts‎test/fixtures/test-runner/matching-patterns/typescript-test.ts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.ts test/fixtures/test-runner/matching-patterns/typescript-test.ts renamed to test/fixtures/test-runner/matching-patterns/test/typescript-test.ts

Copy file name to clipboard
File renamed without changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.