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:
Rich Trott committed 2017-02-05 12:27:07 -08:00
1 parent 9a0829d728
commit 950ef82aaf
2 files changed
+2 -7

No files matched your search

@@ -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', '']);
}));
+1 -4
View File
@@ -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', '']);
}));