Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync skip; aborting execution error thrown when this.skip() inside function #14867

Closed
przemek-rzedkowski opened this issue Feb 2, 2021 · 23 comments · Fixed by #19279 or #19331
Closed
Assignees

Comments

@przemek-rzedkowski
Copy link

przemek-rzedkowski commented Feb 2, 2021

Current behavior

Scenarios skipped with use of "@Focus" annotation generates a bug as seen on screenshot:
image

Focused scenario(s) run(s) correctly. It happened shortly after upgrading cypress to v.6.4.0 (I was using 6.3.0 before). Also I am using cypress-cucumber-preprocessor v.4.0.0. Problem disappears while running tests without annotation.
It's my first bug here so if you need any additional info please let me know, I will gladly provide :)

Desired behavior

It should simply run focused scenario(s) and skip the rest of them without failing .

Versions

Cypress v.6.4.0
cypress-cucumber-preprocessor v.4.0.0

@dthisner
Copy link

dthisner commented Feb 3, 2021

I have the same issue, example project can be located here that reproduces the issue: https://github.com/dthisner/cypressIssue
Issue logged at the cucumber-preprocess repo: badeball/cypress-cucumber-preprocessor#503

@jennifer-shehane jennifer-shehane changed the title Cucumber @focus annotation breaks tests sync skip; aborting execution error thrown when this.skip() inside function Feb 3, 2021
@jennifer-shehane
Copy link
Member

As mentioned previously in the cucumber project, this can be reproduced solely in Cypress using the following code:

it("should work", function () {
  cy.then(() => this.skip()); // throws "sync skip; aborting execution"
});

This is sync skip; aborting execution error is being thrown from Mocha here: https://mochajs.org/api/runnable.js.html

/**
 * Halt and mark as pending.
 *
 * @memberof Mocha.Runnable
 * @public
 */
Runnable.prototype.skip = function() {
  this.pending = true;
  throw new Pending('sync skip; aborting execution');
};

I guess we're not handling this correctly in this case. This seems to have always errored in this case.

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Feb 3, 2021
@vishnuprabhu-95
Copy link

I am facing same issue!

@bennymeade
Copy link

Same issue for me, to avoid this issue I had to roll back to:
"cypress": "^6.3.0",
"cypress-cucumber-preprocessor": "^4.0.0",

@damsorian
Copy link

Same issue for me, to avoid this issue I had to roll back to:
"cypress": "^6.3.0",

The problem seems to be in the 6.4.0 version, the 6.3.0. works as expected

@przemek-rzedkowski
Copy link
Author

problem seems to be solved in v. 6.5.0

@narayananpalani
Copy link

Used 6.5.0 this morning and I got the same error when running tags in my repo.

@ataul821
Copy link

ataul821 commented Apr 4, 2021

I see the same issue in 6.5.0 as well.

@IIsijola
Copy link

I am having the same issue with version 7.0.1

@martinsik
Copy link
Contributor

Same thing in 7.2.0 :(.

@canansaricelik
Copy link

same issue on 7.4.0

@neilmatillano
Copy link

I also get it in latest 7.5.0 version
Screenshot 2021-06-14 at 14 46 14

@sKavanaghV
Copy link

I also get it in latest 7.5.0 version
Screenshot 2021-06-14 at 14 46 14

This error will trigger Cypress to take screenshots and for the skip'd test. In the Cucumber scenario where many tests can be skipped based upon the specified tags, the number of screenshots could be significant; increasing test execution time and generating unnecessary screenshots.

@bahmutov
Copy link
Contributor

Try using this plugin https://github.com/cypress-io/cypress-grep - I think it would make more sense to grep by title or tag rather than skip tests once the test has started.

@guthizon
Copy link

guthizon commented Jul 7, 2021

I'm same error yet! Do you some news?

@Ex4l
Copy link

Ex4l commented Jul 8, 2021

Same here with "cypress": "^7.7.0" and "cypress-cucumber-preprocessor": "^4.1.3"

I don't even have any tags in my feature file.

It's the same in Windows or in WSL.

image

Ok for anyone wondering why it's not working with cypress-cucumber-preprocessor, if you have tags in your cypress open command you must use them.

I had not @ignore and @focus tags and thought I could omit the tags on my feature files. No, you can't. So either you get rid of them when launching tests by Cypress open doing cypress open --env TAGS='' --browser chrome, either you add @focus tag on each test to be able to launch it manually.

@stevenlafl
Copy link

stevenlafl commented Aug 4, 2021

I'm not sure what's going on here, but I want to have multiple features and target a tag to run, like you're supposed to be able to do. Unfortunately, the second a file doesn't have the tag I specify, it stops ALL execution including any subsequent files that DO have the tag in them. This breaks my use-case and the intent of this feature.

EDIT: So it has to do with headed mode with "--no-exit" enabled. With "cypress run," each spec (feature) runs in isolation (separate browser instance) so with the first test not exiting, we never get to the other files.

@todd-m-kemp
Copy link

Though it doesn't seem like a big deal on its own, this error is appearing as one of the top Most Common Errors for my organization in the Cypress Dashboard which isn't particularly helpful because it is not actionable on our end.

@araujosnathan
Copy link

I was having this problem with Cypress 8.6.0, i did a downgrade to v8.3.1 and it worked. All version above of 8.3.1 to latest, the problem for me is happening.

@sweeyeancheong
Copy link

Using Cypress 8.7.0 and cypress-cucumber-preprocessor 4.3.0.
Solved the error as I missed out '@' on the values entered for TAGS field in my environment json file.

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: ready for work The issue is reproducible and in scope stage: needs review The PR code is done & tested, needs review labels Dec 6, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: pending release and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Dec 7, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 10, 2021

The code for this is done in cypress-io/cypress#19279, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 10, 2021

The code for this is done in cypress-io/cypress#19331, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 21, 2021

Released in 9.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.2.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.