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

Throw Error When Using Nested It Specs #4039

Merged
merged 4 commits into from
Aug 24, 2017
Merged

Throw Error When Using Nested It Specs #4039

merged 4 commits into from
Aug 24, 2017

Conversation

rafaelcalpena
Copy link

Summary

I have recently started using Jest and I really like it. I tried adding nested it/test conditions, but I didn't realize that was not allowed, because both tests will succeed (nested test, however, never runs). I've added some changes to throw an error to let the devs know that such pattern is not allowed.

Test plan

test('make sure 2 equals 3', () => {
  test('nested test confuses the devs', () => {
    expect(2).toBe(3);
  })
});
 FAIL  ./jest-it.test.js
   make sure 2 equals 3

    Test `nested test confuses the devs` cannot run because it is nested in `make sure 2 equals 3`

      at Env.it (../jest/packages/jest-jasmine2/build/jasmine/Env.js:396:15)
      at Object.<anonymous>.test (jest-it.test.js:4:3)
          at Promise (<anonymous>)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:169:7)

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants