diff --git a/package.json b/package.json index faf8bf78c..69402d50a 100644 --- a/package.json +++ b/package.json @@ -73,11 +73,11 @@ "dev-test": "jest --bail --watch \"^(?!.*\\.integ\\.spec\\.js$)\"", "docs:dev": "vuepress dev docs", "docs:build": "vuepress build docs", - "posttest": "scripts/run-script test", - "pretest": "eslint --ignore-path .gitignore .", "prettify": "prettier --ignore-path .gitignore --write '**/*.{js,jsx,md,mjs,ts,tsx}'", - "test": "jest \"^(?!.*\\.integ\\.spec\\.js$)\"", + "test": "npm run test-lint && npm run test-unit", "test-integration": "jest \".integ\\.spec\\.js$\"", + "test-lint": "eslint --ignore-path .gitignore .", + "test-unit": "jest \"^(?!.*\\.integ\\.spec\\.js$)\" && scripts/run-script test", "travis-tests": "scripts/travis-tests" }, "workspaces": [ diff --git a/scripts/travis-tests b/scripts/travis-tests index 097ca102f..4933cf896 100755 --- a/scripts/travis-tests +++ b/scripts/travis-tests @@ -2,12 +2,8 @@ const { execFileSync, spawnSync } = require('child_process') -const run = (command, args) => { - const { status } = spawnSync(command, args, { stdio: 'inherit' }) - if (status !== 0) { - process.exit(status) - } -} +const run = (command, args) => + spawnSync(command, args, { stdio: 'inherit' }).status const getFiles = () => execFileSync( @@ -30,12 +26,17 @@ const getFiles = () => if (process.env.TRAVIS_PULL_REQUEST !== 'false') { const files = getFiles().filter(_ => _.endsWith('.js')) if (files.length !== 0) { - run( - './node_modules/.bin/jest', - ['--findRelatedTests', '--passWithNoTests'].concat(files) + process.exit( + run( + './node_modules/.bin/jest', + ['--findRelatedTests', '--passWithNoTests'].concat(files) + ) ) } } else { - run('yarn', ['test']) - run('yarn', ['test-integration']) + process.exit( + run('yarn', ['test-lint']) + + run('yarn', ['test-unit']) + + run('yarn', ['test-integration']) + ) }