Skip to content

Commit

Permalink
fix(cypress task): Return error when tests fail
Browse files Browse the repository at this point in the history
Make au cypress --run emit error when a test failed to allow a build
process/step to fail.

Closes #1057
  • Loading branch information
michaelw85 committed Feb 20, 2019
1 parent 45646e1 commit 7fa7e9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/resources/tasks/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import cypress from 'cypress';
import { CLIOptions } from 'aurelia-cli';
import config from '../../cypress.config';

export default () => {
export default (resolve) => {
if (CLIOptions.hasFlag('run')) {
cypress.run(config);
cypress
.run(config)
.then(results => (results.totalFailed === 0 ? resolve() : resolve('Run failed!')))
.catch(resolve);
} else {
cypress.open(config);
}
Expand Down
7 changes: 5 additions & 2 deletions lib/resources/tasks/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import * as cypress from 'cypress';
import { CLIOptions } from 'aurelia-cli';
import * as config from '../../cypress.config';

export default () => {
export default (resolve) => {
if (CLIOptions.hasFlag('run')) {
cypress.run(config);
cypress
.run(config)
.then(results => (results.totalFailed === 0 ? resolve() : resolve('Run failed!')))
.catch(resolve);
} else {
cypress.open(config);
}
Expand Down

0 comments on commit 7fa7e9e

Please sign in to comment.