Closed xeger closed 2 months ago
It seems that @vitest/browser/context isn't properly coordinating with vitest-browser-react; I'm not sure of the specifics.
@vitest/browser/context
vitest-browser-react
import { page, userEvent } from '@vitest/browser/context'; import { beforeEach, describe, expect, test } from 'vitest'; test('reproduction', () => { const user = userEvent.setup(); const screen = page.render(<span>hello, world</span>); await user.hover(page.getByRole('button')); });
This results in:
reproduction Error: Could not determine window of node. Node was [object Object] - /src/__tests__/reproduction.test.tsx:7:2
👎 Tried swapping the order of render vs. setup 👎 Tried const user = userEvent; in case the setup is unnecessary
render
setup
const user = userEvent;
This is not an error with this library, it's a bug in Vitest.
It seems that
@vitest/browser/context
isn't properly coordinating withvitest-browser-react
; I'm not sure of the specifics.Reproduction
This results in:
Troubleshooting
👎 Tried swapping the order of
render
vs.setup
👎 Triedconst user = userEvent;
in case the setup is unnecessary