Skip to content
Permalink
Browse files

feat(cypress): update cypress to reflect changes for running with cus…

…tom port & host
  • Loading branch information...
shahabganji authored and 3cp committed Aug 16, 2019
1 parent d665ef1 commit 50c7de5000ddc2e8353736b2b0e554f4ac0d3cf7
Showing with 25 additions and 2 deletions.
  1. +25 −2 skeleton/cypress/aurelia_project/tasks/cypress.ext
@@ -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.
You can’t perform that action at this time.