forked from vuejs/vuepress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
32 lines (27 loc) · 754 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const minimist = require('minimist')
const { createJestRunner } = require('@vuepress/test-utils')
const { createApp } = require('@vuepress/core')
const rawArgs = process.argv.slice(2)
const args = minimist(rawArgs)
let regex
if (args.p) {
const packages = (args.p || args.package).split(',').join('|')
regex = `.*@vuepress/(${packages}|plugin-(${packages}))/.*\\.spec\\.js$`
const i = rawArgs.indexOf('-p')
rawArgs.splice(i, 2)
}
const jestRunner = createJestRunner([
'--config', 'scripts/jest.config.js',
'--runInBand',
...(regex ? [regex] : [])
])
// ensure the basic temp files were genereatod
createApp({
temp: '.temp'
})
.process()
.then(() => jestRunner())
.catch(err => {
console.error(err)
process.exit(1)
})