refactor: simplify test script

This commit is contained in:
Evan You
2018-08-13 12:09:30 -04:00
parent 86184fe6c8
commit 8d639396fc
2 changed files with 14 additions and 25 deletions

View File

@@ -28,14 +28,9 @@
"setupFiles": [
"<rootDir>/scripts/testSetup.js"
],
"testPathIgnorePatterns": [
"/template/",
"/packages/test/",
"/temp/",
"/scripts/",
".*.helper.js"
],
"testMatch": ["**/*.spec.js"]
"testMatch": [
"**/*.spec.js"
]
},
"lint-staged": {
"*.{js,vue}": [
@@ -63,6 +58,7 @@
"lerna": "^2.8.0",
"lint-staged": "^7.2.0",
"memfs": "^2.8.0",
"minimist": "^1.2.0",
"puppeteer": "^1.0.0",
"request": "^2.83.0",
"request-promise-native": "^1.0.5",

View File

@@ -1,6 +1,4 @@
const execa = require('execa')
const minimist = require('minimist')
const rawArgs = process.argv.slice(2)
const args = minimist(rawArgs)
@@ -12,18 +10,13 @@ if (args.p) {
rawArgs.splice(i, 2)
}
;(async () => {
const jestArgs = [
'--env', 'node',
'--runInBand',
...rawArgs,
...(regex ? [regex] : [])
]
console.log(`running jest with args: ${jestArgs.join(' ')}`)
await execa('jest', jestArgs, {
stdio: 'inherit'
})
})().catch(err => {
err
process.exit(1)
})
const jestArgs = [
'--env', 'node',
'--runInBand',
...rawArgs,
...(regex ? [regex] : [])
]
console.log(`running jest with args: ${jestArgs.join(' ')}`)
require('jest').run(jestArgs)