Skip to content

Commit

Permalink
workflow: fix test script args
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 2, 2018
1 parent 29557a7 commit 4f095f0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
const execa = require('execa')
const minimist = require('minimist')

const args = minimist(process.argv.slice(2))
const rawArgs = process.argv.slice(2)
const args = minimist(rawArgs)

let regex = args._[0]
if (args.p || args.package) {
let regex
if (args.p) {
const packages = (args.p || args.package).split(',').join('|')
regex = `.*@vue/(${packages}|cli-plugin-(${packages}))/.*\\.spec\\.js$`
const i = rawArgs.findIndex('-p')
rawArgs.splice(i, 2)
}

;(async () => {
await execa('jest', [
const jestArgs = [
'--env', 'node',
'--runInBand',
...rawArgs,
...(regex ? [regex] : [])
], {
]
console.log(`running jest with args: ${jestArgs.join(' ')}`)
await execa('jest', jestArgs, {
stdio: 'inherit'
})
})().catch(err => {
Expand Down

0 comments on commit 4f095f0

Please sign in to comment.