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 · Fixed by #4159
Closed

Throws error on Cypress.log without previous command #3658

bahmutov opened this issue Mar 6, 2019 · 5 comments · Fixed by #4159
Assignees
Labels
good first issue Good for newcomers pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@bahmutov
Copy link
Contributor

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

@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Mar 6, 2019
@jennifer-shehane jennifer-shehane added type: bug pkg/driver This is due to an issue in the packages/driver directory good first issue Good for newcomers difficulty: 1️⃣ labels Mar 6, 2019
@louise-hayes
Copy link
Contributor

I'd like to try resolve this?

@bahmutov
Copy link
Contributor Author

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 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 cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope stage: work in progress stage: needs review The PR code is done & tested, needs review labels May 8, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels May 15, 2019
@jennifer-shehane jennifer-shehane self-assigned this May 16, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels May 16, 2019
@cypress-bot
Copy link
Contributor

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
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
good first issue Good for newcomers pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
4 participants