Skip to content

Commit 8d63939

Browse files
committed
refactor: simplify test script
1 parent 86184fe commit 8d63939

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,9 @@
2828
"setupFiles": [
2929
"<rootDir>/scripts/testSetup.js"
3030
],
31-
"testPathIgnorePatterns": [
32-
"/template/",
33-
"/packages/test/",
34-
"/temp/",
35-
"/scripts/",
36-
".*.helper.js"
37-
],
38-
"testMatch": ["**/*.spec.js"]
31+
"testMatch": [
32+
"**/*.spec.js"
33+
]
3934
},
4035
"lint-staged": {
4136
"*.{js,vue}": [
@@ -63,6 +58,7 @@
6358
"lerna": "^2.8.0",
6459
"lint-staged": "^7.2.0",
6560
"memfs": "^2.8.0",
61+
"minimist": "^1.2.0",
6662
"puppeteer": "^1.0.0",
6763
"request": "^2.83.0",
6864
"request-promise-native": "^1.0.5",

scripts/test.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const execa = require('execa')
21
const minimist = require('minimist')
3-
42
const rawArgs = process.argv.slice(2)
53
const args = minimist(rawArgs)
64

@@ -12,18 +10,13 @@ if (args.p) {
1210
rawArgs.splice(i, 2)
1311
}
1412

15-
;(async () => {
16-
const jestArgs = [
17-
'--env', 'node',
18-
'--runInBand',
19-
...rawArgs,
20-
...(regex ? [regex] : [])
21-
]
22-
console.log(`running jest with args: ${jestArgs.join(' ')}`)
23-
await execa('jest', jestArgs, {
24-
stdio: 'inherit'
25-
})
26-
})().catch(err => {
27-
err
28-
process.exit(1)
29-
})
13+
const jestArgs = [
14+
'--env', 'node',
15+
'--runInBand',
16+
...rawArgs,
17+
...(regex ? [regex] : [])
18+
]
19+
20+
console.log(`running jest with args: ${jestArgs.join(' ')}`)
21+
22+
require('jest').run(jestArgs)

0 commit comments

Comments
 (0)