diff --git a/lib/resources/tasks/cypress.js b/lib/resources/tasks/cypress.js index 5efd5f614..9133bfe58 100644 --- a/lib/resources/tasks/cypress.js +++ b/lib/resources/tasks/cypress.js @@ -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); } diff --git a/lib/resources/tasks/cypress.ts b/lib/resources/tasks/cypress.ts index e128638d1..7dee63b5e 100644 --- a/lib/resources/tasks/cypress.ts +++ b/lib/resources/tasks/cypress.ts @@ -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); }