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

Assertions run outside of a test should be handled properly in Cypress (not throw internal errors) #3926

Closed
jennifer-shehane opened this issue Apr 9, 2019 · 2 comments · Fixed by #3927
Assignees
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@jennifer-shehane
Copy link
Member

Current behavior:

When you write assertions outside of a test (failing & passing), Cypress throws an error "cannot read 'id' of undefined"

This is being thrown when attempting to create the logs for a test when the runnable is undefined.

Furthermore, Cypress attempts to iterate over the stylesheets of the current document. Since there is no document, this throws an error that it "cannot read 'stylesheets' of undefined"

Desired behavior:

When you write assertions outside of a test (failing & passing), Cypress should handles these correctly.

  • Passing assertions should pass
  • Failing assertions should warn that you have a failure outside of a proper test - that you should probably write a test to put your assertions into.

Steps to reproduce: (app code and test code)

  1. Create a specfile within cypress/integration
  2. Write expect(true).to.be.true to test the passing behavior.
  3. Write expect(true).to.be.false to test the failing behavior.

Versions

Cypress 3.2.0

@jennifer-shehane jennifer-shehane added type: bug pkg/driver This is due to an issue in the packages/driver directory stage: work in progress labels Apr 9, 2019
@jennifer-shehane jennifer-shehane self-assigned this Apr 9, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Apr 9, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 9, 2019

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

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Apr 9, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 17, 2019

Released in 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant