-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: always recreate observer in beforeEach
#716
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
isMockFunction
beforeEach
I gave this a try (installed via pkg.pr.new) using Vitest and got a lot of these errors:
and then also:
I imagine the // vitest.setup.ts
beforeAll(() => {
vi.stubGlobal('jest', {
// Workaround for an issue in @testing-library/react.
// see https://github.com/testing-library/react-testing-library/issues/1197
advanceTimersByTime: vi.advanceTimersByTime.bind(vi),
// The fn property is needed for react-intersection-observer/test-utils to
// work when globalThis.jest is overriden like this.
fn: vi.fn.bind(vi)
});
}); Removing that block makes all the |
All these Jest hacks - Headache. You could solve this by also forwarding the |
beforeEach
.beforeAll
, since it would be overwritten by thebeforeEach
Fixes #699