Skip to content

Commit

Permalink
test: minor fixups for REPL eval tests
Browse files Browse the repository at this point in the history
The `process.on("exit")` event handlers are unnecessary, so it’s okay
to drop them.

Ref: nodejs#11871
  • Loading branch information
addaleax committed Mar 20, 2017
1 parent 2a4a5f0 commit 3859673
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions test/parallel/test-repl-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const repl = require('repl');
const options = {
eval: common.mustCall((cmd, context) => {
// Assertions here will not cause the test to exit with an error code
// so set a boolean that is checked in process.on('exit',...) instead.
// so set a boolean that is checked later instead.
evalCalledWithExpectedArgs = (cmd === '\n');
})
};
Expand All @@ -23,7 +23,5 @@ const repl = require('repl');
r.write('.exit\n');
}

process.on('exit', () => {
assert(evalCalledWithExpectedArgs);
});
assert(evalCalledWithExpectedArgs);
}
6 changes: 2 additions & 4 deletions test/parallel/test-repl-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const repl = require('repl');
const options = {
eval: common.mustCall((cmd, context) => {
// Assertions here will not cause the test to exit with an error code
// so set a boolean that is checked in process.on('exit',...) instead.
// so set a boolean that is checked later instead.
evalCalledWithExpectedArgs = (cmd === 'function f() {}\n' &&
context.foo === 'bar');
})
Expand All @@ -29,7 +29,5 @@ const repl = require('repl');
r.write('.exit\n');
}

process.on('exit', () => {
assert(evalCalledWithExpectedArgs);
});
assert(evalCalledWithExpectedArgs);
}

0 comments on commit 3859673

Please sign in to comment.