-
Notifications
You must be signed in to change notification settings - Fork 186
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
Does not recognise Vitest 2 inside beforeAll
hook
#689
Comments
Workaround // vitest.setup.ts
import { setupIntersectionMocking } from "react-intersection-observer/test-utils";
setupIntersectionMocking(vi.fn); // vitest.config.ts
export default defineConfig({
test: {
setupFiles: ["vitest.setup.ts"],
}
}); |
Interesting. I'll have a look. |
@RobinTail are you sure it's running with I've tried upgrading the library itself to Vitest 2, and it doesn't break anything. |
absolutely! I'm surprised myself: I checked your code and found out that it should just check the presence of export default defineConfig({
test: {
globals: true,
environment: "happy-dom", I also tried |
Maybe it's because of this settings. I will try another pool. pool: "vmThreads",
poolOptions: {
vmThreads: { useAtomics: true, memoryLimit: 0.5 },
}, |
No, |
#690 The tests using the |
I'll try to prepare a sandbox to reproduce it |
Dear @thebuilder , here is the VM that reproduces the issue: https://codesandbox.io/p/devbox/crimson-night-w64sxn In terminal try to execute (you may probably need to be logged in for that) |
Thanks a lot - I think the problem (in the example) is that you trigger If I change it so import { mockAllIsIntersecting } from "react-intersection-observer/test-utils";
describe("Test", () => {
test("test", () => {
mockAllIsIntersecting(true);
expect(true).toBeTruthy();
});
}); Looking at the code in |
Yes, @thebuilder , BUT :) |
I see it's actually
So maybe in Vitest 2 |
beforeAll
hook
It runs in Regardless, I'm not sure why you are triggering the |
Ok |
Reset mocking you do in react-intersection-observer/src/test-utils.ts Lines 33 to 35 in 7feb5b6
In react-intersection-observer/src/test-utils.ts Lines 24 to 29 in 7feb5b6
|
Describe the bug A clear and concise description of what the bug is.
When trying to upgrade Vitest from 1.6 to 2.0 I'm getting these warnings:
To Reproduce Try and recreate the issue in a Codesandbox:
none yet
Expected behavior A clear and concise description of what you expected to
happen.
Should detect Vitest 2 similar to Vitest 1.6
Additional context Add any other context about the problem here.
Running latest version, 9.10.3
The text was updated successfully, but these errors were encountered: