Skip to content
Permalink
Browse files

fix(cypress task): Return error when tests fail

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 7fa7e9e5db16be51a38aa9b42eecfcbac93230e4
Showing with 10 additions and 4 deletions.
  1. +5 −2 lib/resources/tasks/cypress.js
  2. +5 −2 lib/resources/tasks/cypress.ts
@@ -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);
}
@@ -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);
}

0 comments on commit 7fa7e9e

Please sign in to comment.
You can’t perform that action at this time.