Skip to content

Commit

Permalink
fix(testing): force dev server to exit when exiting.
Browse files Browse the repository at this point in the history
  • Loading branch information
barbados-clemens committed May 22, 2023
1 parent e9daeb8 commit b656cba
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/cypress/src/executors/cypress/cypress.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,26 @@ export default async function cypressExecutor(
options = normalizeOptions(options, context);
// this is used by cypress component testing presets to build the executor contexts with the correct configuration options.
process.env.NX_CYPRESS_TARGET_CONFIGURATION = context.configurationName;
let success;
let success: boolean;
const devServerIter = startDevServer(options, context);

for await (const devServerValues of startDevServer(options, context)) {
for await (const devServerValues of devServerIter) {
try {
success = await runCypress(devServerValues.baseUrl, {
...options,
portLockFilePath: devServerValues.portLockFilePath,
});
if (!options.watch) break;
if (!options.watch) {
devServerIter.return();
break;
}
} catch (e) {
logger.error(e.message);
success = false;
if (!options.watch) break;
if (!options.watch) {
devServerIter.return();
break;
}
}
}

Expand Down

0 comments on commit b656cba

Please sign in to comment.