-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parallel/test-runner-output
is flaky
#55390
Comments
It was previously reported in #52139 |
FWIW That flake was caused by the different issue |
I've been working on updating the old |
@redyetidev could you be more specific? I'm not sure I understand your previous comment. |
Yes, sorry for the confusion. During my porting of the test runner for In this case, the failing test is Essentially, the Everythingimport { fileURLToPath } from 'node:url';
import path from 'node:path';
const stackFramesRegexp = /(?<=\n)(\s+)((.+?)\s+\()?(?:\(?(.+?):(\d+)(?::(\d+))?)\)?(\s+\{)?(\[\d+m)?(\n|$)/g;
const windowNewlineRegexp = /\r/g;
function replaceNodeVersion(str) {
return str.replaceAll(process.version, '*');
}
function replaceStackTrace(str, replacement = '$1*$7$8\n') {
return str.replace(stackFramesRegexp, replacement);
}
function replaceWindowsLineEndings(str) {
return str.replace(windowNewlineRegexp, '');
}
function replaceWindowsPaths(str) {
return (process.platform === 'win32') ? str.replaceAll(path.win32.sep, path.posix.sep) : str;
}
function replaceFullPaths(str) {
return str.replaceAll('\\\'', "'").replaceAll(path.resolve(__dirname, '../..'), '');
}
function transform(...args) {
return (str) => args.reduce((acc, fn) => fn(acc), str);
}
const root = fileURLToPath(new URL('../..', import.meta.url)).slice(0, -1);
const color = '(\\[\\d+m)';
const stackTraceBasePath = new RegExp(`${color}\\(${root.replaceAll(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g');
function replaceSpecDuration(str) {
return str
.replaceAll(/[0-9.]+ms/g, '*ms')
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
.replace(stackTraceBasePath, '$3');
}
const specTransform = transform(
replaceSpecDuration,
replaceWindowsLineEndings,
replaceStackTrace,
replaceWindowsPaths,
); For typical stack traces, this is fine: const output = `
Error: ...
[90m at Test.runInAsyncScope (node:async_hooks:211:14)[39m
[90m at Test.run (node:internal/test_runner/test:934:25)[39m
[90m at Test.processPendingSubtests (node:internal/test_runner/test:633:18)[39m
[90m at Test.postRun (node:internal/test_runner/test:1045:19)[39m
`.trim();
console.log(specTransform(output));
However, if there's a slight difference in the output, such as it being cut off for some reason: const output = `
Error: ...
[90m at Test.runInAsyncScope (node:async_hooks:211:14)[39m
[90m at Test.run (node:internal/test_runner/test:934:25)[39m
[90m at Test.processPendingSubtests (node:internal/test_runner/test:633:18)[39m
[90m at Test.postRun (node:internal/test
`.trim();
console.log(specTransform(output));
The line is logged. |
Something is causing it to be cutoff (maybe?) which is an issue, however, IMO the stack remover shouldn't be so strict, I.E. it should know that "[90m at" is a stack trace, and handle the whole line. |
Test
parallel/test-runner-output
Platform
Windows
Console output
Build links
Additional information
I feel this is likely an issue with
replaceStackTrace
inassertSnapshot
, sincestartSubtestAfterBootstrap
is logged...The text was updated successfully, but these errors were encountered: