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.skipblock. - Define a
beforeAllinside thedescribe.skipblock. Do something within thebeforeAllfunction to confirm that it does or does not get run (e.g. add aconsole.logstatement, 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:
- Created 4 years ago
- Reactions:45
- Comments:14 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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)returninside of beforeAll.I too am seeing this.