File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
packages/@vuepress/test-utils/lib Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ const usedPorts = []
66 * Run jest
77 *
88 * @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
1010 */
1111
12- module . exports = function createJestRunner ( jestArgs , rawArgs ) {
12+ module . exports = function createJestRunner ( jestArgs , debug ) {
1313 return async function ( ) {
1414 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' )
1617 console . log ( `running node with args: ${ args . join ( ' ' ) } ` )
17- args . unshift ( ...rawArgs , require . resolve ( 'jest-cli/bin/jest' ) )
1818 await execa ( 'node' , args , {
1919 stdio : 'inherit'
2020 } )
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ const rawArgs = process.argv.slice(2)
66const args = minimist ( rawArgs )
77
88let regex
9+ const debug = ! ! args [ 'inspect-brk' ]
10+
911if ( args . p ) {
1012 const packages = ( args . p || args . package ) . split ( ',' ) . join ( '|' )
1113 regex = `.*@vuepress/(${ packages } |plugin-(${ packages } ))/.*\\.spec\\.(js|ts)$`
@@ -17,7 +19,7 @@ const jestRunner = createJestRunner([
1719 '--config' , 'scripts/jest.config.js' ,
1820 '--runInBand' ,
1921 ...( regex ? [ regex ] : [ ] )
20- ] , rawArgs )
22+ ] , debug )
2123
2224// ensure the basic temp files were generated
2325createApp ( {
You can’t perform that action at this time.
0 commit comments