File tree 2 files changed +7
-5
lines changed
packages/@vuepress/test-utils/lib
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ const usedPorts = []
6
6
* Run jest
7
7
*
8
8
* @param {array } jestArgs an array of Jest CLI options
9
- * @param {array } rawArgs the processed process.argv - contains '--inspect-brk' for debug
9
+ * @param {array } debug whether start with '--inspect-brk' or not
10
10
*/
11
11
12
- module . exports = function createJestRunner ( jestArgs , rawArgs ) {
12
+ module . exports = function createJestRunner ( jestArgs , debug ) {
13
13
return async function ( ) {
14
14
const execArgv = getChildProcessExecArgv ( )
15
- const args = [ ...execArgv , ...jestArgs ]
15
+ const args = [ require . resolve ( 'jest-cli/bin/jest' ) , ...execArgv , ...jestArgs ]
16
+ if ( debug ) args . unshift ( '--inspect-brk' )
16
17
console . log ( `running node with args: ${ args . join ( ' ' ) } ` )
17
- args . unshift ( ...rawArgs , require . resolve ( 'jest-cli/bin/jest' ) )
18
18
await execa ( 'node' , args , {
19
19
stdio : 'inherit'
20
20
} )
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ const rawArgs = process.argv.slice(2)
6
6
const args = minimist ( rawArgs )
7
7
8
8
let regex
9
+ const debug = ! ! args [ 'inspect-brk' ]
10
+
9
11
if ( args . p ) {
10
12
const packages = ( args . p || args . package ) . split ( ',' ) . join ( '|' )
11
13
regex = `.*@vuepress/(${ packages } |plugin-(${ packages } ))/.*\\.spec\\.(js|ts)$`
@@ -17,7 +19,7 @@ const jestRunner = createJestRunner([
17
19
'--config' , 'scripts/jest.config.js' ,
18
20
'--runInBand' ,
19
21
...( regex ? [ regex ] : [ ] )
20
- ] , rawArgs )
22
+ ] , debug )
21
23
22
24
// ensure the basic temp files were generated
23
25
createApp ( {
You can’t perform that action at this time.
0 commit comments