Version
v20.4.0
Platform
Darwin MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
This code occurs infinite loop.
import { run } from 'node:test'
import { tap } from 'node:test/reporters';
const stream = run({
// files: undefined
}).compose(tap);
stream.pipe(process.stdout);
How often does it reproduce? Is there a required condition?
everytime
What is the expected behavior? Why is that the expected behavior?
Default is written astest runner execution model. But it does not work.
https://nodejs.org/api/test.html#runoptions
files: An array containing the list of files to run. Default matching files from test runner execution model
It seems that tests that are run during node --test should be run when files is empty.
What do you see instead?
https://github.com/koh110/minimum-nodejs-test
$ node test-run-null-files.mjs
TAP version 13
# TAP version 13
# \# TAP version 13
# \# \\\# TAP version 13
# \# \\\# \\\\\\\# TAP version 13
# \# \\\# \\\\\\\# \\\\\\\\\\\\\\\# TAP version 13
# \# \\\# \\\\\\\# \\\\\\\\\\\\\\\# \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\# TAP version 13
Additional information
createTestFileList gets its own file path.
It seems that it have to exclude own file path when executing in run.
const hasUserSuppliedPattern = process.argv.length > 1;
const patterns = hasUserSuppliedPattern ? ArrayPrototypeSlice(process.argv, 1) : [kDefaultPattern];
console.log('createTestFileList:', hasUserSuppliedPattern, patterns);
|
const cwd = process.cwd(); |
|
const hasUserSuppliedPattern = process.argv.length > 1; |
|
const patterns = hasUserSuppliedPattern ? ArrayPrototypeSlice(process.argv, 1) : [kDefaultPattern]; |
let testFiles = files ?? createTestFileList();
if (shard) {
testFiles = ArrayPrototypeFilter(testFiles, (_, index) => index % shard.total === shard.index - 1);
}
console.log('testFiles: ', testFiles);
|
let testFiles = files ?? createTestFileList(); |
|
|
|
if (shard) { |
|
testFiles = ArrayPrototypeFilter(testFiles, (_, index) => index % shard.total === shard.index - 1); |
|
} |
$ ~/dev/node/out/Release/node ./test-run-null-files.mjs
createTestFileList: true [ '/xxx/minimum-nodejs-test/test-run-null-files.mjs' ]
testFiles: [ '/xxx/minimum-nodejs-test/test-run-null-files.mjs' ]
TAP version 13
# createTestFileList: true [ '/xxx/minimum-nodejs-test/test-run-null-files.mjs' ]
# testFiles: [ '/xxx/minimum-nodejs-test/test-run-null-files.mjs' ]
# TAP version 13
Version
v20.4.0
Platform
Darwin MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
This code occurs infinite loop.
How often does it reproduce? Is there a required condition?
everytime
What is the expected behavior? Why is that the expected behavior?
Default is written as
test runner execution model. But it does not work.https://nodejs.org/api/test.html#runoptions
It seems that tests that are run during
node --testshould be run whenfilesis empty.What do you see instead?
https://github.com/koh110/minimum-nodejs-test
Additional information
createTestFileListgets its own file path.It seems that it have to exclude own file path when executing in
run.node/lib/internal/test_runner/runner.js
Lines 90 to 92 in 9988130
node/lib/internal/test_runner/runner.js
Lines 473 to 477 in 9988130