Skip to content

Commit fbd4955

Browse files
Trottitaloacasas
authored andcommitted
test: simplify output handling in repl tests
Replace .map() + .replace().trim() with a single .replace(). PR-URL: #11124 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Italo A. Casas <[email protected]>
1 parent ce3dcca commit fbd4955

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

test/known_issues/test-repl-require-context.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ outputStream.setEncoding('utf8');
1919
outputStream.on('data', (data) => output += data);
2020

2121
r.on('exit', common.mustCall(() => {
22-
const results = output.split('\n').map((line) => {
23-
return line.replace(/\w*>\w*/, '').trim();
24-
});
22+
const results = output.replace(/^> /mg, '').split('\n');
2523

2624
assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
2725
}));

test/parallel/test-repl-require-context.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ child.stdout.on('data', (data) => {
1414
});
1515

1616
child.on('exit', common.mustCall(() => {
17-
const results = output.split('\n').map((line) => {
18-
return line.replace(/\w*>\w*/, '').trim();
19-
});
20-
17+
const results = output.replace(/^> /mg, '').split('\n');
2118
assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
2219
}));
2320

0 commit comments

Comments
 (0)