@@ -28,21 +28,29 @@ module.exports = api => {
28
28
'--timeout, -t' : 'timeout threshold in milliseconds' ,
29
29
'--bail, -b' : 'bail after first test failure' ,
30
30
'--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'
32
33
} ,
33
34
details : (
34
35
`The above list only includes the most commonly used options.\n` +
35
36
`For a full list of available options, see\n` +
36
37
`http://zinserjan.github.io/mocha-webpack/docs/installation/cli-usage.html`
37
38
)
38
39
} , ( args , rawArgv ) => {
40
+ const inspectPos = rawArgv . indexOf ( '--inspect-brk' )
41
+ let nodeArgs = [ ]
42
+ if ( inspectPos !== - 1 ) {
43
+ nodeArgs = rawArgv . splice ( inspectPos , inspectPos + 1 )
44
+ }
39
45
// for @vue /babel-preset-app
40
46
process . env . VUE_CLI_BABEL_TARGET_NODE = true
41
47
// start runner
42
48
const { execa } = require ( '@vue/cli-shared-utils' )
43
49
const bin = require . resolve ( 'mocha-webpack/bin/mocha-webpack' )
44
50
const hasInlineFilesGlob = args . _ && args . _ . length
45
51
const argv = [
52
+ ...nodeArgs ,
53
+ bin ,
46
54
'--recursive' ,
47
55
'--require' ,
48
56
require . resolve ( './setup.js' ) ,
@@ -57,7 +65,7 @@ module.exports = api => {
57
65
]
58
66
59
67
return new Promise ( ( resolve , reject ) => {
60
- const child = execa ( bin , argv , { stdio : 'inherit' } )
68
+ const child = execa ( 'node' , argv , { stdio : 'inherit' } )
61
69
child . on ( 'error' , reject )
62
70
child . on ( 'exit' , code => {
63
71
if ( code !== 0 ) {
0 commit comments