Skip to content

Commit

Permalink
refactor: simplify test script
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 13, 2018
1 parent 86184fe commit 8d63939
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}": [
Expand Down Expand Up @@ -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",
Expand Down
27 changes: 10 additions & 17 deletions scripts/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const execa = require('execa')
const minimist = require('minimist')

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

Expand All @@ -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)

0 comments on commit 8d63939

Please sign in to comment.