test: simplify output handling in repl tests
Replace .map() + .replace().trim() with a single .replace(). PR-URL: https://github.com/nodejs/node/pull/11124 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
This commit is contained in:
parent
9a0829d728
commit
950ef82aaf
@ -19,9 +19,7 @@ outputStream.setEncoding('utf8');
|
||||
outputStream.on('data', (data) => output += data);
|
||||
|
||||
r.on('exit', common.mustCall(() => {
|
||||
const results = output.split('\n').map((line) => {
|
||||
return line.replace(/\w*>\w*/, '').trim();
|
||||
});
|
||||
const results = output.replace(/^> /mg, '').split('\n');
|
||||
|
||||
assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
|
||||
}));
|
||||
|
@ -14,10 +14,7 @@ child.stdout.on('data', (data) => {
|
||||
});
|
||||
|
||||
child.on('exit', common.mustCall(() => {
|
||||
const results = output.split('\n').map((line) => {
|
||||
return line.replace(/\w*>\w*/, '').trim();
|
||||
});
|
||||
|
||||
const results = output.replace(/^> /mg, '').split('\n');
|
||||
assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']);
|
||||
}));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user