@@ -28,21 +28,29 @@ module.exports = api => {
2828 '--timeout, -t' : 'timeout threshold in milliseconds' ,
2929 '--bail, -b' : 'bail after first test failure' ,
3030 '--require, -r' : 'require the given module before running tests' ,
31- '--include' : 'include the given module into test bundle'
31+ '--include' : 'include the given module into test bundle' ,
32+ '--inspect-brk' : 'Enable inspector to debug the tests'
3233 } ,
3334 details : (
3435 `The above list only includes the most commonly used options.\n` +
3536 `For a full list of available options, see\n` +
3637 `http://zinserjan.github.io/mocha-webpack/docs/installation/cli-usage.html`
3738 )
3839 } , ( args , rawArgv ) => {
40+ const inspectPos = rawArgv . indexOf ( '--inspect-brk' )
41+ let nodeArgs = [ ]
42+ if ( inspectPos !== - 1 ) {
43+ nodeArgs = rawArgv . splice ( inspectPos , inspectPos + 1 )
44+ }
3945 // for @vue /babel-preset-app
4046 process . env . VUE_CLI_BABEL_TARGET_NODE = true
4147 // start runner
4248 const { execa } = require ( '@vue/cli-shared-utils' )
4349 const bin = require . resolve ( 'mocha-webpack/bin/mocha-webpack' )
4450 const hasInlineFilesGlob = args . _ && args . _ . length
4551 const argv = [
52+ ...nodeArgs ,
53+ bin ,
4654 '--recursive' ,
4755 '--require' ,
4856 require . resolve ( './setup.js' ) ,
@@ -57,7 +65,7 @@ module.exports = api => {
5765 ]
5866
5967 return new Promise ( ( resolve , reject ) => {
60- const child = execa ( bin , argv , { stdio : 'inherit' } )
68+ const child = execa ( 'node' , argv , { stdio : 'inherit' } )
6169 child . on ( 'error' , reject )
6270 child . on ( 'exit' , code => {
6371 if ( code !== 0 ) {
0 commit comments