fix(tests): fix tests run fail in the Chinese directory #3586
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
in #3582 ,
when vite's workspace contains Chinese directory,vite tests run fails in Windows
it is caused by the slash component vite use to convert Windows backslash paths to slash paths
e.g the path
foo/bar
in Unix will be slashed to befoo\\bar
in Windowshowever,while the directory containes Chinese charactor,the slash will return the original path, which will not be converted according to the source code.
by the way, I found out that vite implements its own slash function in the utils file,but the test cases are still use the slash component,This is what caused the test cases run fail
···
export function slash(p: string): string {
return p.replace(/\/g, '/')
}
···
Close #3582
What is the purpose of this pull request?