-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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 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:
setup-after-env.js:
console.log("setup-after-env")
beforeAll(() => console.log("setup beforeAll"))
beforeEach(() => console.log("setup beforeEach"))
afterEach(() => console.log("setup afterEach"))
afterAll(() => console.log("setup afterAll"))demo.test.js:
it("should work", () => console.log("test"))With jest-light-runner, this only prints:
setup-after-env
test
edit: Here's a minimal reproduction repo
Expected behavior
setup-after-env
setup beforeAll
setup beforeEach
test
setup afterEach
setup afterAll