Skip to content

Commit a35f5a1

Browse files
committed
fix: fail to test specific package
1 parent 8a6be07 commit a35f5a1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/@vuepress/test-utils/lib/createJestRunner.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
const execa = require('execa')
2-
const rawArgs = process.argv.slice(2)
32

43
const 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} rawArgs the processed process.argv - contains '--inspect-brk' for debug
10+
*/
11+
12+
module.exports = function createJestRunner (jestArgs, rawArgs) {
713
return async function () {
814
const execArgv = getChildProcesExecArgv()
915
const args = [...execArgv, ...jestArgs]

scripts/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const args = minimist(rawArgs)
88
let regex
99
if (args.p) {
1010
const packages = (args.p || args.package).split(',').join('|')
11-
regex = `.*@vuepress/(${packages}|plugin-(${packages}))/.*\\.spec\\.js$`
11+
regex = `.*@vuepress/(${packages}|plugin-(${packages}))/.*\\.spec\\.(js|ts)$`
1212
const i = rawArgs.indexOf('-p')
1313
rawArgs.splice(i, 2)
1414
}
@@ -17,7 +17,7 @@ const jestRunner = createJestRunner([
1717
'--config', 'scripts/jest.config.js',
1818
'--runInBand',
1919
...(regex ? [regex] : [])
20-
])
20+
], rawArgs)
2121

2222
// ensure the basic temp files were generated
2323
createApp({

0 commit comments

Comments
 (0)