Skip to content
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

fix: test files path in windows #1908

Closed
wants to merge 1 commit into from
Closed

fix: test files path in windows #1908

wants to merge 1 commit into from

Conversation

YaDev
Copy link

@YaDev YaDev commented Aug 24, 2022

This is a fix for "Error: No test suite found" in Windows.

This should force it to use uppercase letters for the drivers.

For more info :
nodejs/node#6624

Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should make a util function out of this? Or open PR to pathe for this? We don't use Node's path, and I thought the goal of pathe is to make pathing consistent.

@YaDev
Copy link
Author

YaDev commented Sep 1, 2022

Unfortunately, pathe uses path and does not solve this problem.
https://github.com/unjs/pathe/blob/main/src/path.ts

I think the filtering is not going to work well in windows
"testFiles = testFiles.filter(i => filters.some(f => i.includes(f)))"

cause
c:\project\src\tests\file.ts
is equal to
C:\project\src\tests\file.ts
in Windows.

so, one of these commands
"npx vitest C:\......." or "npx vitest c:\......."

will fail 100%.

cmd, powershell, vscode & other IDEs can run into this issue. (had it on powershell and vscode)

fs.realpathSync.native might fix it but I think this solution should be the best for now until a refactoring is done to the globTestFiles function.

So, move it to util ? (I totally agree with that)

@sheremet-va
Copy link
Member

Unfortunately, pathe uses path and does not solve this problem.

https://github.com/unjs/pathe/blob/main/src/path.ts

I think the filtering is not going to work well in windows

"testFiles = testFiles.filter(i => filters.some(f => i.includes(f)))"

cause

c:\project\src\tests\file.ts

is equal to

C:\project\src\tests\file.ts

in Windows.

so, one of these commands

"npx vitest C:\......." or "npx vitest c:\......."

will fail 100%.

cmd, powershell, vscode & other IDEs can run into this issue. (had it on powershell and vscode)

fs.realpathSync.native might fix it but I think this solution should be the best for now until a refactoring is done to the globTestFiles function.

So, move it to util ? (I totally agree with that)

Of course it's using path, but I don't see the problem? They are wrapping it to make it consistent across platforms, which you are trying to do here. We can open PR to fix this issue on their side, I think.

@YaDev
Copy link
Author

YaDev commented Sep 2, 2022

It is pointless to argue.
You should read pathe's documentations carefully. If pathe's team should fix this problem, then go ahead and create a PR. Otherwise, submit a ticket for nodejs like :
nodejs/node#38459

or fix it on your end.

@YaDev YaDev closed this by deleting the head repository Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants