diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index 0b22d1f63f3dea..df1834a869688b 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -588,7 +588,7 @@ function run(options = kEmptyObject) { execArgv = [], argv = [], cwd = process.cwd(), - bail = false, + bail, } = options; if (files != null) { @@ -688,14 +688,16 @@ function run(options = kEmptyObject) { validateStringArray(argv, 'options.argv'); validateStringArray(execArgv, 'options.execArgv'); - validateBoolean(bail, 'options.bail'); - // TODO(pmarchini): watch mode with bail needs to be implemented - if (bail && watch) { - throw new ERR_INVALID_ARG_VALUE( - 'options.bail', - watch, - 'bail is not supported while watch mode is enabled', - ); + if (bail != null) { + validateBoolean(bail, 'options.bail'); + // TODO(pmarchini): watch mode with bail needs to be implemented + if (bail && watch) { + throw new ERR_INVALID_ARG_VALUE( + 'options.bail', + watch, + 'bail is not supported while watch mode is enabled', + ); + } } const rootTestOptions = { __proto__: null, concurrency, timeout, signal };