File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
packages/@vuepress/test-utils/lib Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 11const execa = require ( 'execa' )
2- const rawArgs = process . argv . slice ( 2 )
32
43const usedPorts = [ ]
54
6- module . exports = function createJestRunner ( jestArgs ) {
5+ /**
6+ * Run jest
7+ *
8+ * @param {array } jestArgs an array of Jest CLI options
9+ * @param {array } debug whether start with '--inspect-brk' or not
10+ */
11+
12+ module . exports = function createJestRunner ( jestArgs , debug ) {
713 return async function ( ) {
8- const execArgv = getChildProcesExecArgv ( )
9- const args = [ ...execArgv , ...jestArgs ]
14+ const execArgv = getChildProcessExecArgv ( )
15+ const args = [ require . resolve ( 'jest-cli/bin/jest' ) , ...execArgv , ...jestArgs ]
16+ if ( debug ) args . unshift ( '--inspect-brk' )
1017 console . log ( `running node with args: ${ args . join ( ' ' ) } ` )
11- args . unshift ( ...rawArgs , require . resolve ( 'jest-cli/bin/jest' ) )
1218 await execa ( 'node' , args , {
1319 stdio : 'inherit'
1420 } )
1521 }
1622}
1723
18- function getChildProcesExecArgv ( ) {
24+ function getChildProcessExecArgv ( ) {
1925 const execArgv = process . execArgv . slice ( 0 )
2026 const inspectArgvIndex = execArgv . findIndex ( argv =>
2127 argv . includes ( '--inspect-brk' )
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ 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 ( '|' )
11- regex = `.*@vuepress/(${ packages } |plugin-(${ packages } ))/.*\\.spec\\.js $`
13+ regex = `.*@vuepress/(${ packages } |plugin-(${ packages } ))/.*\\.spec\\.(js|ts) $`
1214 const i = rawArgs . indexOf ( '-p' )
1315 rawArgs . splice ( i , 2 )
1416}
@@ -17,7 +19,7 @@ const jestRunner = createJestRunner([
1719 '--config' , 'scripts/jest.config.js' ,
1820 '--runInBand' ,
1921 ...( regex ? [ regex ] : [ ] )
20- ] )
22+ ] , debug )
2123
2224// ensure the basic temp files were generated
2325createApp ( {
You can’t perform that action at this time.
0 commit comments