beforeAll functions are run even when defined inside of a describe.skip block.
describe.skip block.beforeAll inside the describe.skip block.beforeAll function to confirm that it does or does not get run (e.g. add a console.log statement, set some flag, etc.).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.
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
I too am seeing this.
Yep, experiencing this too, it's pretty consistent (full disclosure: I work with @weworkwithzoh)
beforeAll() , always runs
$ jest -v
24.8.0
upvote please
Hi, I have created this workaround, by adding a additioinal flag
is it possible to get the skipped flag from the jest context?
describe.skip('Testing confirmations', () => {
var skip = false //bug beforeAll is always run even when skipped, do it this way
beforeAll(async () => {
if(skip)return
....
});
test('Testing ', () => {
/////.....
});
});
This is especially painful when using Jest for functional tests that do some heavy lifting in beforeAll. For example, writing some Selenium tests that work with a service like Browserstack. In beforeAll, you'd usually create a new WebDriver that's connected to their service, which takes a while. I'm forced to comment out tests I don't wan to run, otherwise they slow down my workflow significantly.
If anyone is looking for an easy substitute for .skip, just create a new dummy function at the top of your file, like:
const describeSkip = () => {}
Then append Skip instead of .skip.
up
Quick question, does running it with jest-circus fixes the issue?
It did for us, yes.
On Mon, 2 Dec 2019 at 20:08 Rogelio Guzman notifications@github.com wrote:
Quick question, does running it with (jest-circus)[
https://github.com/facebook/jest/tree/master/packages/jest-circus] fixes
the issue?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/jest/issues/8379?email_source=notifications&email_token=AAIQFYF5PQGXJKMLV2ZKD4LQWVFK5A5CNFSM4HIN42T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFUL25Y#issuecomment-560512375,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAIQFYECHQAHUVPY6EZEOXDQWVFK5ANCNFSM4HIN42TQ
.
If anyone is looking for an easy substitute for
.skip, just create a new dummy function at the top of your file, like:
const describeSkip = () => {}Then append
Skipinstead of.skip.
Unfortunately we have an entire test suite that we want to be conditionally skipped. This "works", but Jest fails with:
Your test suite must contain at least one test
So we have to include a dummy describe(). 😢
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.
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.
me too
+1 seeing the same issue on 25.1.0, MacOS, node 12.16.1.
Started seeing failed tests in CI in our junit reports for skipped tests, and it turned out to be this issue.
Most helpful comment
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.