question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress it.skip fails

See original GitHub issue

Where to find the issue

Cypress tests under development in cypress/e2e.

Describe the issue

If a Cypress test is changed from it to it.skip for debugging purposes, other tests which do not have the skip attribute applied do not run and the following error is produced:

TypeError
The following error originated from your test code, not from Cypress.

> Cannot set properties of undefined (setting 'body')

This is a development issue only. It does not affect the website itself.

Steps to reproduce

Create a new test spec test.skip.cy.js in cypress/e2e/ with the following contents:

it("test 1 - run this", () => { 
    cy.log("test 1 log")
});
it.skip("test 2 - skip this", () => { 
    cy.log("test 2 log")
});

Execute npm run test:open Select test.skip.cy.js

This produces the error > Cannot set properties of undefined (setting 'body') and no tests are executed.

Regression with Cypress 10.11.0

Going back one minor version from Cypress 10.11.0 to 10.10.0 removes the issue:

Execute: npm install cypress@10.10.0

Repeat the above test.

test 1 runs, test 2 is skipped. This is correct.

Regression with monkey-patch

npm install cypress@latest Edit cypress/support/e2e.js and remove all code starting with the comment line // soft assert for finding broken links, see also check_links.js to the end of the file.

Repeat the test.

test 1 runs, test 2 is skipped. This is correct.

Code issue

cypress/support/e2e.js

contains the code

https://github.com/corona-warn-app/cwa-website/blob/a0c749adcb8e197c7eaf054631a2db26de11a5d0/cypress/support/e2e.js#L93-L109

that modifies the standard behaviour of Cypress / mocha.

Without this code, it.skip works as expected.

Reference

Cypress documentation

Excluding and Including Tests

“To skip a specified suite or test, append .skip() to the function. All nested suites will also be skipped.”

Suggestion

Since this is a minor development issue only, I suggest no change at this time.


Internal Tracking ID: EXPOSUREAPP-14292

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
brianebelingcommented, Nov 7, 2022

@MikeMcC399

Great, thank you! I wasn’t aware there is already activity from cypress’s side. Then we will monitor how things go and come back to the issue when there is a fix.

0reactions
MikeMcC399commented, Nov 7, 2022

@brianebeling

I wouldn’t want to downgrade Cypress to 10.10.0 and it wouldn’t solve the related it.only issue. In the meantime a community member who already proposed a solution for the it.only issue said that they would look at solving the it.skip issue as well (see https://github.com/cypress-io/cypress/discussions/23280#discussioncomment-4056067), so I would hold back.

I agree that this is not high impact or urgency and I have only shared it for completeness.

Thanks anyway for your attention!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Skip and Only in Cypress - TestersDock
Skip and only comes from the Mocha framework in cypress. As the name suggests skip skips the tests and only executes the current...
Read more >
Skipping a test in Cypress conditionally - Stack Overflow
My intention is to check if an error is displayed on a website, and skip the test if it does. Otherwise continue with...
Read more >
Skip test conditionally with Cypress - Filip Hric
In this blog, I'd like to show you various strategies and tools how you can skip your test and run them conditionally.
Read more >
Skipping Cypress tests on first failure and save resources in CI ...
All the code is now in place to skip the tests if it failed. Just one last thing. Cypress automatically clears all cookies...
Read more >
cypress-io/cypress-skip-test: Simple commands to ... - GitHub
Simple commands to skip a test based on platform, browser or a url - GitHub - cypress-io/cypress-skip-test: Simple commands to skip a test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found