question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

beforeAll: not skipped within describe.skip (again)

See original GitHub issue

🐛 Bug Report

beforeAll functions are run even when defined inside of a describe.skip block.

To Reproduce

  • Define a describe.skip block.
  • Define a beforeAll inside the describe.skip block. Do something within the beforeAll function to confirm that it does or does not get run (e.g. add a console.log statement, set some flag, etc.).

Expected behavior

The function registered by the beforeAll is never executed.

This bug was reported in https://github.com/facebook/jest/issues/6166 and fixed in https://github.com/facebook/jest/pull/6234, but it reappeared.

Link to repl or repo (highly encouraged)

https://codesandbox.io/s/74xr2vrpnj (use the Tests tab)

Jest runs via react-scripts at this version: https://github.com/facebook/create-react-app/blob/v2.1.8/package.json#L28

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:45
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
enriqu3lcommented, Feb 5, 2020

Any update here?

As far as I know, this was a previous bug that appeared again.

Currently I am using the workaround of adding if(skip)return inside of beforeAll.

4reactions
weworkwithzohcommented, May 16, 2019

I too am seeing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to skip all tests if beforeAll failed? Using Jasmine and ...
1 Answer 1 · I've tried protractor-fail-fast but in the case when beforeAll fails - the first it in the file still marked...
Read more >
Globals - Jest
Beware that the describe block will still run. If you have some setup that also should be skipped, do it in a beforeAll...
Read more >
JasmineJS - Skip Block - Tutorialspoint
Depending on the level of application, this block can be called as a Skipping Spec and Skipping Suite respectively. In the following example,...
Read more >
Delayed root suite pending tests, exclusive tests and inclusive ...
The pending tests will be included in the test results, and will ... This skips all it,beforeEach/afterEach, and describe blocks within the ...
Read more >
Test runner | Node.js v19.3.0 Documentation
Subtests; Skipping tests; describe / it syntax; only tests; Filtering tests by name ... This module is only available under the node: scheme....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found