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
Mocking modules not working with whitespace in file path #1210
Comments
Well, we also run tests on windows in our CI 🤔 |
Hey guys, any progress with this issue? |
@sheremet-va i found the problem. vitest/packages/vitest/src/utils/source-map.ts Lines 24 to 25 in 306b545
a stacktrace line
i would prefer:
|
Hm, how does it affect mocking tho? Or the problem is not about mocking? |
mocking if working correctly. the problem is the whitespace in the directory name |
@pYr0x I'll check it in a few minutes... |
@sheremet-va the mocking is not working on Windows when the path has some spaces, the same project just renaming from On project with spaces in the path, the suite mocks are just: Just download the ZIP from the original and rename it: the problem should be on macosx/linux. We have something strange using latest on vitest dep, I cannot find the regex for stackFnCallRE but the version is 0.10.0. |
it seems not working on other OS when there are spaces on the path, I talk with @pYr0x your regex works but we'll use similar approach from here: https://www.npmjs.com/package/error-stack-parser The last source entry will be fixed on the PR: {
method: '',
file: 'F:/work/projects/quini/GitHub/issue-repro/vitest mock issue 1210/test/foo.test.ts',
line: '3',
column: '30',
source: ' at F:/work/projects/quini/GitHub/issue-repro/vitest mock issue 1210/test/foo.test.ts:3:30'
} |
@userquin is this bug fixed? |
Describe the bug
i had trouble with mocking a module. the module will not be mocked. so i found a test on vitest test's.
https://github.com/vitest-dev/vitest/blob/main/test/core/test/hoist-import.test.ts
i tried to reproduce the test in my project and it failed. so i tried to create a stackblitz and it worked... !?
the only difference i can see is that i am working on a windows machine
Reproduction
stackblitz with working test:
https://stackblitz.com/edit/vitest-dev-vitest-ma89ey
Github Repo that i used locally on my windows 10 machine (and it failed)
https://github.com/pYr0x/vitest_mock
i used pnpm and npm. both not working for my locally
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: