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

Crash if a "describe" block does not have a callback function #2115

Closed
bahmutov opened this issue Jul 10, 2018 · 3 comments
Closed

Crash if a "describe" block does not have a callback function #2115

bahmutov opened this issue Jul 10, 2018 · 3 comments
Assignees

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Jul 10, 2018

reproduction in https://github.com/cypress-io/cypress-test-tiny branch empty-describe

Whenever describe has just a function, or just a name (without a callback function) Cypress (probably Mocha engine inside) dies a violent death. Both these crash with Uncaught TypeError: Cannot read property 'call' of undefined

describe(function page() {})

describe('nope')

screen shot 2018-07-10 at 2 43 07 pm

Code at crash site

context.describe = context.context = function(title, fn) {
  var suite = Suite.create(suites[0], title);
  suite.file = file;
  suites.unshift(suite);
  fn.call(suite);
  suites.shift();
  return suite;
};

Note that tests without a callback function are fine, they are just pending, so it('works') has no problems.

  • Cypress 3.0.1
  • Mac
@lilaconlee
Copy link
Contributor

Took a stab at a more specific error message instead of fixing to keep the same behavior as mocha:
screen shot 2019-03-05 at 3 39 46 pm

Down to set the suite to pending if that's preferred.

@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 Mar 12, 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 Mar 21, 2019
@jennifer-shehane
Copy link
Member

I confirmed this bug is still happening in Cypress 3.8.0

@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: work in progress labels Feb 18, 2020
@jennifer-shehane
Copy link
Member

This fails with a much better error - testing in Cypress 6.2.1. Closing as resolved.

Screen Shot 2021-01-05 at 5 54 24 PM

@jennifer-shehane jennifer-shehane removed the stage: ready for work The issue is reproducible and in scope label Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants