From 8d639396fcac802329718d435cf82d6d59deafb2 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 13 Aug 2018 12:09:30 -0400 Subject: [PATCH] refactor: simplify test script --- package.json | 12 ++++-------- scripts/test.js | 27 ++++++++++----------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index bff15e516..a6d5a1c3d 100644 --- a/package.json +++ b/package.json @@ -28,14 +28,9 @@ "setupFiles": [ "/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", diff --git a/scripts/test.js b/scripts/test.js index a821fd4ae..3e4ae7a81 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -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)