test_runner: change ts default glob

PR-URL: https://github.com/nodejs/node/pull/57359
Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
Marco Ippolito authored and RafaelGSS committed 2025-05-02 17:05:03 -03:00
1 parent 8e07d42a5f
commit 650fc9baba
6 files changed
+7 -10

No files matched your search

+3 -6
View File
@@ -418,12 +418,9 @@ By default, Node.js will run all files matching these patterns:
Unless [`--no-experimental-strip-types`][] is supplied, the following
additional patterns are also matched:
* `**/*.test.{cts,mts,ts}`
* `**/*-test.{cts,mts,ts}`
* `**/*_test.{cts,mts,ts}`
* `**/test-*.{cts,mts,ts}`
* `**/test.{cts,mts,ts}`
* `**/test/**/*.{cts,mts,ts}`
* `**/test/**/*-test.{cts,mts,ts}`
* `**/test/**/*.test.{cts,mts,ts}`
* `**/test/**/*_test.{cts,mts,ts}`
Alternatively, one or more glob patterns can be provided as the
final argument(s) to the Node.js command, as shown below.
+1 -1
View File
@@ -108,7 +108,7 @@ let kResistStopPropagation;
function createTestFileList(patterns, cwd) {
const hasUserSuppliedPattern = patterns != null;
if (!patterns || patterns.length === 0) {
patterns = [kDefaultPattern];
patterns = kDefaultPattern;
}
const glob = new Glob(patterns, {
__proto__: null,
+3 -3
View File
@@ -55,10 +55,10 @@ const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
const kFileExtensions = ['js', 'mjs', 'cjs'];
const kDefaultPattern = [`**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`];
if (getOptionValue('--experimental-strip-types')) {
ArrayPrototypePush(kFileExtensions, 'ts', 'mts', 'cts');
ArrayPrototypePush(kDefaultPattern, '**/test/**/*{-,.,_}test.{cts,mts,ts}');
}
const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`;
function createDeferredCallback() {
let calledCount = 0;
@@ -290,7 +290,7 @@ function parseCommandLine() {
if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) {
// TODO(pmarchini): this default should follow something similar to c8 defaults
// Default exclusions should be also exported to be used by other tools / users
coverageExcludeGlobs = [kDefaultPattern];
coverageExcludeGlobs = kDefaultPattern;
}
coverageIncludeGlobs = getOptionValue('--test-coverage-include');