expect.getState().testPath
only works when called inside of test function
#6367
Labels
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
Based on this reproduction: https://stackblitz.com/edit/vitest-dev-vitest-w9khjv?file=test%2Fbasic.test.ts,test%2Fsuite.test.ts,vitest.config.ts&initialPath=__vitest__/
The following code:
yields:
I'd expect that
expect.getState().testPath
would always work when invoked in the file, regardless of its position. Seems like it also yields undefined when called inside ofdescribe
calls.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-w9khjv?file=test%2Fbasic.test.ts,test%2Fsuite.test.ts,vitest.config.ts&initialPath=__vitest__/
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: