Skip to content

Commit bb947ce

Browse files
Trottcodebytere
authored andcommitted
test: improve test-debug-usage
test-debug-usage fails if run with `--trace-warnings` because the regular expression checking does not allow for the resulting stack trace from the deprecation warning. The test also only tests two parts of the three-part usage message. Improve the test so that it passes with `--trace-warnings` and verifies all three parts of the usage message. Signed-off-by: Rich Trott <[email protected]> PR-URL: #32141 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 61d54e7 commit bb947ce

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎test/parallel/test-debug-usage.js‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ child.stderr.setEncoding('utf8');
1111

1212
constexpectedLines=[
1313
/^\(node:\d+\)\[DEP0068\]DeprecationWarning:/,
14-
/^Usage:.*node.*debugscript\.js$/,
15-
/^.*node.*debug<host>:<port>$/
14+
/Usage:.*node.*debugscript\.js\r?\n.*node.*debug<host>:<port>\r?\n.*node.*debug-p<pid>\r?\n$/,
1615
];
1716

1817
letactualUsageMessage='';
@@ -21,11 +20,10 @@ child.stderr.on('data', function(data){
2120
});
2221

2322
child.on('exit',common.mustCall(function(code){
24-
constoutputLines=actualUsageMessage.split('\n');
2523
assert.strictEqual(code,1);
2624
for(leti=0;i<expectedLines.length;i++)
2725
assert.ok(
28-
expectedLines[i].test(outputLines[i]),
29-
`${outputLines[i]} did not match ${expectedLines[i]}`
26+
expectedLines[i].test(actualUsageMessage),
27+
`${actualUsageMessage} did not match ${expectedLines[i]}`
3028
);
3129
}));

0 commit comments

Comments
(0)