After upgrading to 0.31.1: TypeError on spies on get
methods of a global when restoring mocks
#3448
Closed
6 tasks done
Labels
Describe the bug
When you spy on a getter on
global
and restore it after every test withrestoreAllMocks
, there will be TypeErrors becauseglobal
is deemed undefined (TypeError: Cannot read properties of undefined
)The solution is to either downgrade to 0.31.0 or to remove the call to
restoreAllMocks
, which obviously might have other side effects, depending on the test suite. I suspect #3341 to be the culprit, but didn't have the time to investigate further yet.Thank you for reading this and for vitest in general, has been a blast using it so far :)
Reproduction
Github Repo: https://github.com/rmehner/vitest-issue-3448
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: