Skip to content

Commit f7041b9

Browse files
theoludwigtargos
authored andcommitted
Revert "test_runner: change ts default glob"
This reverts commit 9df0ff7. PR-URL: #58202 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
1 parent 9ca4b46 commit f7041b9

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

β€Ždoc/api/test.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,12 @@ By default, Node.js will run all files matching these patterns:
472472
Unless [`--no-experimental-strip-types`][] is supplied, the following
473473
additional patterns are also matched:
474474

475-
* `**/test/**/*-test.{cts,mts,ts}`
476-
* `**/test/**/*.test.{cts,mts,ts}`
477-
* `**/test/**/*_test.{cts,mts,ts}`
475+
* `**/*.test.{cts,mts,ts}`
476+
* `**/*-test.{cts,mts,ts}`
477+
* `**/*_test.{cts,mts,ts}`
478+
* `**/test-*.{cts,mts,ts}`
479+
* `**/test.{cts,mts,ts}`
480+
* `**/test/**/*.{cts,mts,ts}`
478481

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

β€Žlib/internal/test_runner/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ let kResistStopPropagation;
110110
function createTestFileList(patterns, cwd) {
111111
const hasUserSuppliedPattern = patterns != null;
112112
if (!patterns || patterns.length === 0) {
113-
patterns = kDefaultPattern;
113+
patterns = [kDefaultPattern];
114114
}
115115
const glob = new Glob(patterns, {
116116
__proto__: null,

β€Žlib/internal/test_runner/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
6060

6161
const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
6262
const kFileExtensions = ['js', 'mjs', 'cjs'];
63-
const kDefaultPattern = [`**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`];
6463
if (getOptionValue('--experimental-strip-types')) {
65-
ArrayPrototypePush(kDefaultPattern, '**/test/**/*{-,.,_}test.{cts,mts,ts}');
64+
ArrayPrototypePush(kFileExtensions, 'ts', 'mts', 'cts');
6665
}
66+
const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`;
6767

6868
function createDeferredCallback() {
6969
let calledCount = 0;
@@ -295,7 +295,7 @@ function parseCommandLine() {
295295
if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) {
296296
// TODO(pmarchini): this default should follow something similar to c8 defaults
297297
// Default exclusions should be also exported to be used by other tools / users
298-
coverageExcludeGlobs = kDefaultPattern;
298+
coverageExcludeGlobs = [kDefaultPattern];
299299
}
300300
coverageIncludeGlobs = getOptionValue('--test-coverage-include');
301301

0 commit comments

Comments
Β (0)