forked from vuejs/vuepress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
33 lines (28 loc) · 817 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
32
33
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
const debug = !!args['inspect-brk']
if (args.p || args.package) {
const packages = (args.p || args.package).split(',').join('|')
regex = `.*@vuepress/(${packages}|plugin-(${packages}))/.*\\.spec\\.(js|ts)$`
const i = rawArgs.indexOf('-p')
rawArgs.splice(i, 2)
}
const jestRunner = createJestRunner([
'--config', 'scripts/jest.config.js',
'--runInBand',
...(regex ? [regex] : [])
], debug)
// ensure the basic temp files were generated
createApp({
temp: '.temp'
})
.process()
.then(() => jestRunner())
.catch(err => {
console.error(err)
process.exit(1)
})