forked from vuejs/vue-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (27 loc) · 812 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
34
const minimist = require('minimist')
const rawArgs = process.argv.slice(2)
const args = minimist(rawArgs)
let regex
if (args.p) {
const packages = (args.p || args.package).split(',').join('|')
regex = `.*@vue/(${packages}|cli-plugin-(${packages}))/.*\\.spec\\.js$`
const i = rawArgs.indexOf('-p')
rawArgs.splice(i, 2)
}
const e2ePathPattern = 'Migrator|Vue3|mochaPlugin|MochaPlugin|cli-plugin-webpack-4'
if (args['e2e-only']) {
regex = e2ePathPattern
const i = rawArgs.indexOf('--e2e-only')
rawArgs.splice(i, 2)
}
const jestArgs = [
'--env', 'node',
'--runInBand',
...rawArgs,
...(regex ? [regex] : [])
]
if (!args['e2e-only']) {
jestArgs.push('--testPathIgnorePatterns', e2ePathPattern)
}
console.log(`running jest with args: ${jestArgs.join(' ')}`)
require('jest').run(jestArgs)