Skip to content

Commit

Permalink
fix(jest task): Return error when tests fail
Browse files Browse the repository at this point in the history
Remove plugin error, returning a message is enough to make the process
emit an error.
  • Loading branch information
michaelw85 committed Feb 20, 2019
1 parent bfbe072 commit 830bda8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = function(project) {
).addToDevDependencies(
'jest',
'jest-cli',
'plugin-error',
'aurelia-loader-nodejs',
'aurelia-pal-nodejs'
).addNPMScript('test', 'au jest');
Expand Down
3 changes: 1 addition & 2 deletions lib/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"minimatch": "^3.0.4",
"node-sass": "^4.9.3",
"opn": "^5.4.0",
"plugin-error": "^1.0.1",
"protractor": "^5.4.1",
"requirejs": "^2.3.6",
"sass-loader": "^7.1.0",
Expand All @@ -103,4 +102,4 @@
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9",
"webpack-hot-middleware": "^2.24.3"
}
}
5 changes: 2 additions & 3 deletions lib/resources/tasks/jest.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import jest from 'jest-cli';
import PluginError from 'plugin-error';
import path from 'path';
import packageJson from '../../package.json';
import {CLIOptions} from 'aurelia-cli';
import { CLIOptions } from 'aurelia-cli';

export default (cb) => {
let options = packageJson.jest;
Expand All @@ -15,7 +14,7 @@ export default (cb) => {

jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => {
if (results.numFailedTests || results.numFailedTestSuites) {
cb(new PluginError('jest-cli', { message: 'Tests Failed' }));
cb('Tests Failed');
} else {
cb();
}
Expand Down
6 changes: 2 additions & 4 deletions lib/resources/tasks/jest.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as jest from 'jest-cli';
import * as PluginError from 'plugin-error';
import through2 from 'through2';
import * as path from 'path';
import * as packageJson from '../../package.json';
import {CLIOptions} from 'aurelia-cli';
import { CLIOptions } from 'aurelia-cli';

export default (cb) => {
let options = packageJson.jest;
Expand All @@ -14,7 +12,7 @@ export default (cb) => {

jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => {
if (results.numFailedTests || results.numFailedTestSuites) {
cb(new PluginError('jest-cli', { message: 'Tests Failed' }));
cb('Tests Failed');
} else {
cb();
}
Expand Down

0 comments on commit 830bda8

Please sign in to comment.