Skip to content

Commit

Permalink
[EDR Workflows] [Cypress] Fix early return issue in cypress without t…
Browse files Browse the repository at this point in the history
…ags (#166140)
  • Loading branch information
tomsonpl authored Sep 11, 2023
1 parent d7e9a2c commit a27eccb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ ${JSON.stringify(cypressConfigFile, null, 2)}

const isGrepReturnedFilePaths = _.isArray(grepSpecPattern);
const isGrepReturnedSpecPattern = !isGrepReturnedFilePaths && grepSpecPattern === specPattern;
const { grepFilterSpecs } = cypressConfigFile.env;

// IMPORTANT!
// When grep returns the same spec pattern as it gets in its arguments, we treat it as
Expand All @@ -136,7 +137,7 @@ ${JSON.stringify(cypressConfigFile, null, 2)}
// If we don't return early, these specs will start executing, and Cypress will be skipping
// tests at runtime: those that should be excluded according to the tags passed in the config.
// This can take so much time that the job can fail by timeout in CI.
if (isGrepReturnedSpecPattern) {
if (grepFilterSpecs && isGrepReturnedSpecPattern) {
log.info('No tests found - all tests could have been skipped via Cypress tags');
// eslint-disable-next-line no-process-exit
return process.exit(0);
Expand Down

0 comments on commit a27eccb

Please sign in to comment.