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

Comments

1 participant
@jennifer-shehane
Copy link
Member

commented Apr 9, 2019

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

@cypress-bot

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.