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

Throws error on Cypress.log without previous command #3658

Closed
bahmutov opened this issue Mar 6, 2019 · 5 comments
Closed

Throws error on Cypress.log without previous command #3658

bahmutov opened this issue Mar 6, 2019 · 5 comments

Comments

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Mar 6, 2019

Cypress 3.1.5 on Mac

/// <reference types="cypress" />
it('works', () => {
  Cypress.log('after hook')
})

Throws error
screen shot 2019-03-06 at 12 05 52 pm

Code that throws

    _.defaults(obj, current != null ? current.pick("name", "type") : void 0);
    if (!parentOrChildRe.test(obj.type)) {
      obj.type = current.hasPreviouslyLinkedCommand() ? "child" : "parent";
    }

https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cypress/log.coffee#L117

@louise-hayes
Copy link
Contributor

@louise-hayes louise-hayes commented Mar 8, 2019

I'd like to try resolve this?

@bahmutov
Copy link
Contributor Author

@bahmutov bahmutov commented Mar 8, 2019

sure, try @louise-hayes and if I may suggest

  • write a test that is initially failing
  • add a guard around the failing line to fix the failing test
@vrockai
Copy link

@vrockai vrockai commented May 7, 2019

What is the expected behaviour? Cypress.log doesn't accept a string as an argument, therefore I would assume an exception is expected.

FTR it throws the same exception even if I put a command before it:

describe "issue 3658", ->
  it 'Cypress.log should not throw an exception', ->
    cy.visit('/fixtures/generic.html')
    expect(=> Cypress.log('arbitrary_string')).not.to.throw()
@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented May 16, 2019

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

@cypress-bot
Copy link

@cypress-bot 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants