Jest set up global spyOn but exclude for certain tests

Viewed 62

I have a global config file for jest which calls some spyOn methods in a beforeAll. I have it running successfully using the setupFilesAfterEnv option in jest.config file. My question is, is there any way to prevent this global from running for specific files? i want it to run for most, but there are a handful of test files i want to skip. So within the global beforeAll, is there any way to check the next file it is about to apply to?

Alternatively, is there any way to specify in jest.config to run the setupFilesAfterEnv but exclude certain files?

0 Answers
Related