Skip to content

Commit

Permalink
test: simplify output handling in repl tests
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and italoacasas committed Feb 14, 2017
1 parent ce3dcca commit fbd4955
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions test/known_issues/test-repl-require-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '']);
}));
Expand Down
5 changes: 1 addition & 4 deletions test/parallel/test-repl-require-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '']);
}));

Expand Down

0 comments on commit fbd4955

Please sign in to comment.