Skip to content

Commit

Permalink
feat(cypress): update cypress to reflect changes for running with cus…
Browse files Browse the repository at this point in the history
…tom port & host
  • Loading branch information
shahabganji authored and 3cp committed Sep 3, 2019
1 parent d665ef1 commit 50c7de5
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions skeleton/cypress/aurelia_project/tasks/cypress.ext
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,37 @@ import * as cypress from 'cypress';
import * as config from '../../cypress.config';
// @endif
import { CLIOptions } from 'aurelia-cli';
import * as project from '../aurelia.json';
import { default as runAppServer, shutdownAppServer } from './run';

export default (cb) => {
const runCypress = (cb) => {
if (CLIOptions.hasFlag('run')) {
const port = CLIOptions.getFlagValue('port') || project.platform.port;
cypress
.run(config)
.then(results => (results.totalFailed === 0 ? cb() : cb('Run failed!')))
.then(results => {
if (results.totalFailed === 0) {
shutdownAppServer().then(cb);
}
else {
shutdownAppServer(1)
.then(_ => {
cb('Tests failed');
});
}
})
.catch(cb);
} else {
cypress.open(config);
}
}

export default (cb) => {
if (CLIOptions.hasFlag('start')) {
runCypress(cb);
runAppServer();
return;
}

runCypress(cb);
};

0 comments on commit 50c7de5

Please sign in to comment.