Browse Source

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>
v7.x
Rich Trott 8 years ago
committed by Italo A. Casas
parent
commit
fbd495583e
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 4
      test/known_issues/test-repl-require-context.js
  2. 5
      test/parallel/test-repl-require-context.js

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

@ -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', '']);
}));

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

@ -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…
Cancel
Save