You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JS framework: react 18.3.1 (though not used in test)
Test environment: vitest 3.0.8
DOM implementation: Not sure, Vitest docs say that the default environment is node. I haven't installed any of the optional environments like js-dom or happy-dom.
Additional context
This problem looks similar to #839, but that issue has been fixed, and the workarounds suggested there didn't seem to do anything.
Most strangely, when I console.log(userEvent.setup) it prints:
[Function: setupMain]
Similarly typeof userEvent.setup also tells me that it's a function.
But when I call the function userEvent.setup() I get the error.
I figured out the cause. I had not installed any of the vitest dom environments. After installing happy-dom the test started to work.
So feel free to close this issue. Though it would be nicer if the error message one gets when no DOM environment is present would not be quite as mysterious as this.
Uh oh!
There was an error while loading. Please reload this page.
Reproduction example
https://github.com/nene/test-userevent
Prerequisites
Sorry, I don't know how to work with tests in codesandbox. Instead I provide a repository:
git clone [email protected]:nene/test-userevent.git
npm install
npm test
Expected behavior
Tests execute successfully.
Actual behavior
An error occurs:
User-event version
14.6.1
Environment
Testing Library framework:
@testing-library/dom 10.4.0
JS framework:
react 18.3.1
(though not used in test)Test environment:
vitest 3.0.8
DOM implementation: Not sure, Vitest docs say that the default environment is
node
. I haven't installed any of the optional environments likejs-dom
orhappy-dom
.Additional context
This problem looks similar to #839, but that issue has been fixed, and the workarounds suggested there didn't seem to do anything.
Most strangely, when I
console.log(userEvent.setup)
it prints:Similarly
typeof userEvent.setup
also tells me that it's afunction
.But when I call the function
userEvent.setup()
I get the error.I managed to locate this strange Symbol(Node prepared with document state workarounds) inside
user-event
library. But I have no clue what's going on with that.The text was updated successfully, but these errors were encountered: