fix: don't resolve setupFiles from parent directory#9960
Merged
sheremet-va merged 3 commits intovitest-dev:mainfrom Mar 24, 2026
Merged
fix: don't resolve setupFiles from parent directory#9960sheremet-va merged 3 commits intovitest-dev:mainfrom
setupFiles from parent directory#9960sheremet-va merged 3 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
1e57d1d to
bb6e5e8
Compare
hi-ogawa
commented
Mar 24, 2026
Comment on lines
31
to
+42
| function resolvePath(path: string, root: string) { | ||
| // local-pkg (mlly)'s resolveModule("./file", { paths: ["/some/root"] }) tries | ||
| // /some/file | ||
| // /some/file.js | ||
| // /some/root/file | ||
| // /some/root/file.js | ||
| // etc. | ||
| // but we don't want to resolve files from parent directories, | ||
| // so we ensure passing "/" suffix such as "/some/root/" | ||
| // https://github.com/unjs/mlly/blob/401d42983f6f3a9112658d67b0a92ba4fb1d7efa/src/resolve.ts#L104-L110 | ||
| return normalize( | ||
| /* @__PURE__ */ resolveModule(path, { paths: [root] }) | ||
| /* @__PURE__ */ resolveModule(path, { paths: [join(root, '/')] }) |
Collaborator
Author
There was a problem hiding this comment.
This was a way more annoying than I thought. My first solution was merely doing:
if (path[0] === '.' || path[0] === '/') {
return normalize(resolve(root, path))
}
return (...same as before...)but this broke a following test since it was relying on resolveModule to resolve /(full)/file-setup.js:
So, I went back to still rely on resolveModule for relative path.
sheremet-va
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
setupFilewhen inside git worktree #9955Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.