aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ava/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ava/api.js')
-rw-r--r--node_modules/ava/api.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/node_modules/ava/api.js b/node_modules/ava/api.js
index e5c5a7b92..99213a757 100644
--- a/node_modules/ava/api.js
+++ b/node_modules/ava/api.js
@@ -21,7 +21,7 @@ const fork = require('./lib/fork');
function resolveModules(modules) {
return arrify(modules).map(name => {
- const modulePath = resolveCwd(name);
+ const modulePath = resolveCwd.silent(name);
if (modulePath === null) {
throw new Error(`Could not resolve required module '${name}'`);
@@ -60,6 +60,10 @@ class Api extends EventEmitter {
precompiled[resolvedfpath] = hash;
const options = Object.assign({}, this.options, {precompiled});
+ if (runStatus.updateSnapshots) {
+ // Don't use in Object.assign() since it'll override options.updateSnapshots even when false.
+ options.updateSnapshots = true;
+ }
const emitter = fork(file, options, execArgv);
runStatus.observeFork(emitter);
@@ -137,7 +141,8 @@ class Api extends EventEmitter {
runOnlyExclusive: options.runOnlyExclusive,
prefixTitles: this.options.explicitTitles || files.length > 1,
base: path.relative(process.cwd(), commonPathPrefix(files)) + path.sep,
- failFast: this.options.failFast
+ failFast: this.options.failFast,
+ updateSnapshots: options.updateSnapshots
});
this.emit('test-run', runStatus, files);
@@ -171,9 +176,9 @@ class Api extends EventEmitter {
const execArgv = this.options.testOnlyExecArgv || process.execArgv;
let debugArgIndex = -1;
- // --debug-brk is used in addition to --inspect to break on first line and wait
+ // --inspect-brk is used in addition to --inspect to break on first line and wait
execArgv.some((arg, index) => {
- const isDebugArg = arg === '--inspect' || arg.indexOf('--inspect=') === 0;
+ const isDebugArg = /^--inspect(-brk)?($|=)/.test(arg);
if (isDebugArg) {
debugArgIndex = index;
}
@@ -184,7 +189,7 @@ class Api extends EventEmitter {
const isInspect = debugArgIndex >= 0;
if (!isInspect) {
execArgv.some((arg, index) => {
- const isDebugArg = arg === '--debug' || arg === '--debug-brk' || arg.indexOf('--debug-brk=') === 0 || arg.indexOf('--debug=') === 0;
+ const isDebugArg = /^--debug(-brk)?($|=)/.test(arg);
if (isDebugArg) {
debugArgIndex = index;
}