diff --git a/packages/@vue/cli-plugin-unit-mocha/index.js b/packages/@vue/cli-plugin-unit-mocha/index.js index 2fd61f9a12..1769be92a9 100644 --- a/packages/@vue/cli-plugin-unit-mocha/index.js +++ b/packages/@vue/cli-plugin-unit-mocha/index.js @@ -37,9 +37,17 @@ module.exports = api => { `https://sysgears.github.io/mochapack/docs/installation/cli-usage.html` ) }, (args, rawArgv) => { - const inspectPos = rawArgv.indexOf('--inspect-brk') + const inspectStringPrefix = '--inspect-brk' + const matchedInspectArg = rawArgv.filter((value) => { + return (value.substring(0, inspectStringPrefix.length) === inspectStringPrefix) + }) + let nodeArgs = [] - if (inspectPos !== -1) { + + let inspectArg = '' + if (matchedInspectArg.length !== 0) { + inspectArg = matchedInspectArg[0] + const inspectPos = rawArgv.indexOf(inspectArg) nodeArgs = rawArgv.splice(inspectPos, inspectPos + 1) } // for @vue/babel-preset-app <= v4.0.0-rc.7