I consider jest's partial test isolation to be more trouble than it's worth and would rather switch to jest-light-runner, don't mess around with globals (expect with jest.spyOn) and use the built-in jest features to revert these changes after every test.
However, it seems that the resetMocks and restoreMocks config option no longer works with jest-light-runner (probably a separate bug), so I tried working around that using a custom setup script (with setupFilesAfterEnv).
Actual behavior
But it seems that beforeAll, beforeEach, afterEach, afterAll simply do nothing when called from such a script, for example:
Hi there, thanks for the great project!
I consider jest's partial test isolation to be more trouble than it's worth and would rather switch to
jest-light-runner
, don't mess around with globals (expect withjest.spyOn
) and use the built-in jest features to revert these changes after every test.However, it seems that the resetMocks and restoreMocks config option no longer works with
jest-light-runner
(probably a separate bug), so I tried working around that using a custom setup script (with setupFilesAfterEnv).Actual behavior
But it seems that
beforeAll
,beforeEach
,afterEach
,afterAll
simply do nothing when called from such a script, for example:setup-after-env.js
:demo.test.js
:With
jest-light-runner
, this only prints:edit: Here's a minimal reproduction repo
Expected behavior