Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,17 @@ export function createVitestPlugins(pluginOptions: PluginOptions): VitestPlugins
}

// Construct the full, absolute path and normalize it to POSIX format.
const fullPath = toPosixPath(path.join(baseDir, id));
let fullPath: string;
if (path.isAbsolute(id)) {
const relativeId = path.relative(baseDir, id);
fullPath =
!relativeId.startsWith('..') && !path.isAbsolute(relativeId)
? id
: path.join(baseDir, id);
} else {
fullPath = path.join(baseDir, id);
}
fullPath = toPosixPath(fullPath);

if (testFileToEntryPoint.has(fullPath)) {
return fullPath;
Expand Down