Revert "test_runner: change ts default glob"

This reverts commit 9df0ff7015bed1613c09cc0b15b76390d21ee178.

PR-URL: https://github.com/nodejs/node/pull/58202
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
This commit is contained in:
Théo LUDWIG 2025-05-09 07:54:29 +02:00 committed by GitHub
parent 8debf0bddc
commit 264cad75ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 7 deletions

View File

@ -472,9 +472,12 @@ By default, Node.js will run all files matching these patterns:
Unless [`--no-experimental-strip-types`][] is supplied, the following Unless [`--no-experimental-strip-types`][] is supplied, the following
additional patterns are also matched: additional patterns are also matched:
* `**/test/**/*-test.{cts,mts,ts}` * `**/*.test.{cts,mts,ts}`
* `**/test/**/*.test.{cts,mts,ts}` * `**/*-test.{cts,mts,ts}`
* `**/test/**/*_test.{cts,mts,ts}` * `**/*_test.{cts,mts,ts}`
* `**/test-*.{cts,mts,ts}`
* `**/test.{cts,mts,ts}`
* `**/test/**/*.{cts,mts,ts}`
Alternatively, one or more glob patterns can be provided as the Alternatively, one or more glob patterns can be provided as the
final argument(s) to the Node.js command, as shown below. final argument(s) to the Node.js command, as shown below.

View File

@ -110,7 +110,7 @@ let kResistStopPropagation;
function createTestFileList(patterns, cwd) { function createTestFileList(patterns, cwd) {
const hasUserSuppliedPattern = patterns != null; const hasUserSuppliedPattern = patterns != null;
if (!patterns || patterns.length === 0) { if (!patterns || patterns.length === 0) {
patterns = kDefaultPattern; patterns = [kDefaultPattern];
} }
const glob = new Glob(patterns, { const glob = new Glob(patterns, {
__proto__: null, __proto__: null,

View File

@ -60,10 +60,10 @@ const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test']; const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
const kFileExtensions = ['js', 'mjs', 'cjs']; const kFileExtensions = ['js', 'mjs', 'cjs'];
const kDefaultPattern = [`**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`];
if (getOptionValue('--experimental-strip-types')) { if (getOptionValue('--experimental-strip-types')) {
ArrayPrototypePush(kDefaultPattern, '**/test/**/*{-,.,_}test.{cts,mts,ts}'); ArrayPrototypePush(kFileExtensions, 'ts', 'mts', 'cts');
} }
const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`;
function createDeferredCallback() { function createDeferredCallback() {
let calledCount = 0; let calledCount = 0;
@ -295,7 +295,7 @@ function parseCommandLine() {
if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) { if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) {
// TODO(pmarchini): this default should follow something similar to c8 defaults // TODO(pmarchini): this default should follow something similar to c8 defaults
// Default exclusions should be also exported to be used by other tools / users // Default exclusions should be also exported to be used by other tools / users
coverageExcludeGlobs = kDefaultPattern; coverageExcludeGlobs = [kDefaultPattern];
} }
coverageIncludeGlobs = getOptionValue('--test-coverage-include'); coverageIncludeGlobs = getOptionValue('--test-coverage-include');