errors: alter and test ERR_INVALID_REPL_EVAL_CONFIG
changes the base instance for ERR_INVALID_REPL_EVAL_CONFIG from Error to TypeError as a more accurate representation of the error and adds a unit test for the repl options that trigger this error. PR-URL: https://github.com/nodejs/node/pull/19984 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
6dca62b28d
commit
8826cc985a
@ -903,10 +903,8 @@ E('ERR_INVALID_PERFORMANCE_MARK',
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_REPL_EVAL_CONFIG',
|
||||
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', Error);
|
||||
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', TypeError);
|
||||
E('ERR_INVALID_SYNC_FORK_INPUT',
|
||||
'Asynchronous forks do not support Buffer, Uint8Array or string input: %s',
|
||||
TypeError);
|
||||
|
@ -89,7 +89,19 @@ assert.strictEqual(r2.rli.input, r2.inputStream);
|
||||
assert.strictEqual(r2.rli.output, r2.outputStream);
|
||||
assert.strictEqual(r2.rli.terminal, false);
|
||||
|
||||
// Verify that defaults are used when no arguments are provided
|
||||
// 3, breakEvalOnSigint and eval supplied together should cause a throw
|
||||
const r3 = () => repl.start({
|
||||
breakEvalOnSigint: true,
|
||||
eval: true
|
||||
});
|
||||
|
||||
common.expectsError(r3, {
|
||||
code: 'ERR_INVALID_REPL_EVAL_CONFIG',
|
||||
type: TypeError,
|
||||
message: 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'
|
||||
});
|
||||
|
||||
// 4, Verify that defaults are used when no arguments are provided
|
||||
const r4 = repl.start();
|
||||
|
||||
assert.strictEqual(r4._prompt, '> ');
|
||||
|
Loading…
x
Reference in New Issue
Block a user