From 67d327f46e3abda6d23f2ad2099c0d73699c6c0b Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Nov 2026 09:55:26 +0000 Subject: [PATCH 1/5] fix(@angular/build): resolve Vitest artifacts when workspace root is aliased In Vitest 5.1.0, `vitestConfig.root` inherits `viteConfig.root`, which resolves symlinks and Windows `subst` drives via `realpathSync`. Normalize paths under `vitestConfig.root` back to `workspaceRoot` in the in-memory provider plugin so internal setup files and build artifacts resolve consistently. --- .../unit-test/runners/vitest/plugins.ts | 36 ++++++-- .../unit-test/runners/vitest/plugins_spec.ts | 84 +++++++++++++++++++ 2 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts index 37aa4a9828a6..418cf91e41ad 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts @@ -346,20 +346,41 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] toPosixPath(path.isAbsolute(file) ? file : path.join(workspaceRoot, file)), ), ); - let vitestConfig: ResolvedConfig; + let vitestConfig: ResolvedConfig | undefined; + + const normalizeToWorkspace = (filePath: string): string => { + if (vitestConfig?.root && path.isAbsolute(filePath)) { + const relativeToVitestRoot = path.relative(vitestConfig.root, filePath); + if (!relativeToVitestRoot.startsWith('..') && !path.isAbsolute(relativeToVitestRoot)) { + return path.join(workspaceRoot, relativeToVitestRoot); + } + } + + return filePath; + }; /** The build output path served for a module, whether it is a test entry point or a built artifact. */ const getOutputPath = (id: string): string => { - const entryPoint = testFileToEntryPoint.get(id); + const normalizedId = toPosixPath(normalizeToWorkspace(id)); + const entryPoint = testFileToEntryPoint.get(normalizedId); - return entryPoint ? entryPoint + '.js' : toPosixPath(path.relative(workspaceRoot, id)); + return entryPoint + ? entryPoint + '.js' + : toPosixPath(path.relative(workspaceRoot, normalizedId)); }; // Setup files must not be wrapped in a virtual import stub because Vitest only invalidates // the setup file itself between test files; wrapping it would cause the underlying bundle // to be cached, preventing per-test hooks from running on subsequent test files. - const isCoverageRedirect = (id: string): boolean => - !!vitestConfig?.coverage?.enabled && testFileToEntryPoint.has(id) && !setupFileSet.has(id); + const isCoverageRedirect = (id: string): boolean => { + const normalizedId = toPosixPath(normalizeToWorkspace(id)); + + return ( + !!vitestConfig?.coverage?.enabled && + testFileToEntryPoint.has(normalizedId) && + !setupFileSet.has(normalizedId) + ); + }; return [ { @@ -413,9 +434,12 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] } } + id = normalizeToWorkspace(id); + // Determine the base directory for resolution. let baseDir: string; if (importer) { + importer = toPosixPath(normalizeToWorkspace(importer)); // If the importer is a test entry point, resolve relative to the workspace root. // Otherwise, resolve relative to the importer's directory. baseDir = testFileToEntryPoint.has(importer) ? workspaceRoot : path.dirname(importer); @@ -473,7 +497,7 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] const map = sourceMapText ? JSON.parse(sourceMapText) : undefined; if (map) { - adjustSourcemapSources(map, true, workspaceRoot, id); + adjustSourcemapSources(map, true, workspaceRoot, toPosixPath(normalizeToWorkspace(id))); } return { diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts new file mode 100644 index 000000000000..03e7677e07e0 --- /dev/null +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts @@ -0,0 +1,84 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.dev/license + */ + +import path from 'node:path'; +import type { VitestPluginContext } from 'vitest/node'; +import { BuildOutputFileType } from '../../../../tools/esbuild/bundler-files'; +import { toPosixPath } from '../../../../utils/path'; +import type { ResultFile } from '../../../application/results'; +import { createVitestPlugins } from './plugins'; + +describe('createVitestPlugins', () => { + it('resolves and loads setup files when vitestConfig.root differs from workspaceRoot (e.g., symlink or subst drive)', async () => { + const workspaceRoot = path.resolve('/logical-workspace/test-project'); + const physicalRoot = toPosixPath(path.resolve('/physical-disk/tmp/test-project')); + const specFile = toPosixPath(path.join(workspaceRoot, 'src/app/app.spec.ts')); + + const buildResultFiles = new Map([ + [ + 'init-compiler.js', + { + origin: 'memory', + path: 'init-compiler.js', + type: BuildOutputFileType.Root, + contents: new TextEncoder().encode('console.log("init-compiler");'), + hash: 'hash-init-compiler', + }, + ], + [ + 'spec-src-app-app-spec.js', + { + origin: 'memory', + path: 'spec-src-app-app-spec.js', + type: BuildOutputFileType.Root, + contents: new TextEncoder().encode('console.log("spec");'), + hash: 'hash-spec', + }, + ], + ]); + + const testFileToEntryPoint = new Map([[specFile, 'spec-src-app-app-spec']]); + + const plugins = createVitestPlugins({ + workspaceRoot, + projectSourceRoot: path.join(workspaceRoot, 'src'), + projectName: 'test-project', + buildResultFiles, + testFileToEntryPoint, + setupFiles: ['init-compiler.js'], + }); + + const inMemoryPlugin = plugins.find((p) => p.name === 'angular:test-in-memory-provider'); + expect(inMemoryPlugin).toBeDefined(); + + const configureVitest = inMemoryPlugin?.configureVitest as + ((context: VitestPluginContext) => void) | undefined; + configureVitest?.({ + vitest: { + config: { + root: physicalRoot, + }, + }, + } as unknown as VitestPluginContext); + + const resolveId = inMemoryPlugin?.resolveId as ( + id: string, + importer: string | undefined, + ) => string | undefined; + const load = inMemoryPlugin?.load as ( + id: string, + ) => Promise<{ code: string; map?: unknown } | undefined>; + + const expectedSetupId = toPosixPath(path.join(workspaceRoot, 'init-compiler.js')); + const resolvedSetupId = resolveId(`${physicalRoot}/init-compiler.js`, undefined); + expect(resolvedSetupId).toBe(expectedSetupId); + + const loadedSetup = await load(expectedSetupId); + expect(loadedSetup?.code).toBe('console.log("init-compiler");'); + }); +}); From c1d06f39984a4312b6b4210f6a211636b81f8ff2 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Nov 2026 09:58:47 +0000 Subject: [PATCH 2/5] fixup! fix(@angular/build): resolve Vitest artifacts when workspace root is aliased --- .../build/src/builders/unit-test/runners/vitest/plugins.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts index 418cf91e41ad..7632dca9b0d9 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts @@ -351,7 +351,11 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] const normalizeToWorkspace = (filePath: string): string => { if (vitestConfig?.root && path.isAbsolute(filePath)) { const relativeToVitestRoot = path.relative(vitestConfig.root, filePath); - if (!relativeToVitestRoot.startsWith('..') && !path.isAbsolute(relativeToVitestRoot)) { + if ( + relativeToVitestRoot !== '..' && + !relativeToVitestRoot.startsWith('..' + path.sep) && + !path.isAbsolute(relativeToVitestRoot) + ) { return path.join(workspaceRoot, relativeToVitestRoot); } } From 8a9fa180fc654e212313a28d3b9471ee776addd8 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Nov 2026 10:17:17 +0000 Subject: [PATCH 3/5] fixup! fix(@angular/build): resolve Vitest artifacts when workspace root is aliased --- .../builders/unit-test/runners/vitest/executor.ts | 15 ++++++++++----- .../unit-test/runners/vitest/plugins_spec.ts | 13 +++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts index 471f5dea467b..6af8b0a13111 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts @@ -19,6 +19,7 @@ import { updateExternalMetadata, } from '../../../../tools/vite/utils'; import { assertIsError } from '../../../../utils/error'; +import { toPosixPath } from '../../../../utils/path'; import { type FullResult, type IncrementalResult, @@ -377,11 +378,15 @@ export class VitestExecutor implements TestExecutor { // Filter internal entries and setup files from the include list const internalEntries = ['angular:']; const setupFileSet = new Set(testSetupFiles); - const include = [...this.testFileToEntryPoint.keys()].filter((entry) => { - return ( - !internalEntries.some((internal) => entry.startsWith(internal)) && !setupFileSet.has(entry) - ); - }); + const include: string[] = []; + for (const entry of this.testFileToEntryPoint.keys()) { + if ( + !internalEntries.some((internal) => entry.startsWith(internal)) && + !setupFileSet.has(entry) + ) { + include.push(toPosixPath(path.relative(workspaceRoot, entry))); + } + } this.debugLog(DebugLogLevel.Verbose, 'Included test files (after filtering):', include); const vitestConfig = { diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts index 03e7677e07e0..6102ba91fa69 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts @@ -7,14 +7,13 @@ */ import path from 'node:path'; -import type { VitestPluginContext } from 'vitest/node'; import { BuildOutputFileType } from '../../../../tools/esbuild/bundler-files'; import { toPosixPath } from '../../../../utils/path'; import type { ResultFile } from '../../../application/results'; import { createVitestPlugins } from './plugins'; describe('createVitestPlugins', () => { - it('resolves and loads setup files when vitestConfig.root differs from workspaceRoot (e.g., symlink or subst drive)', async () => { + it('resolves and loads setup and spec files when vitestConfig.root differs from workspaceRoot', async () => { const workspaceRoot = path.resolve('/logical-workspace/test-project'); const physicalRoot = toPosixPath(path.resolve('/physical-disk/tmp/test-project')); const specFile = toPosixPath(path.join(workspaceRoot, 'src/app/app.spec.ts')); @@ -57,14 +56,14 @@ describe('createVitestPlugins', () => { expect(inMemoryPlugin).toBeDefined(); const configureVitest = inMemoryPlugin?.configureVitest as - ((context: VitestPluginContext) => void) | undefined; + ((context: { vitest: { config: { root: string } } }) => void) | undefined; configureVitest?.({ vitest: { config: { root: physicalRoot, }, }, - } as unknown as VitestPluginContext); + }); const resolveId = inMemoryPlugin?.resolveId as ( id: string, @@ -80,5 +79,11 @@ describe('createVitestPlugins', () => { const loadedSetup = await load(expectedSetupId); expect(loadedSetup?.code).toBe('console.log("init-compiler");'); + + const resolvedSpecId = resolveId(`${physicalRoot}/src/app/app.spec.ts`, undefined); + expect(resolvedSpecId).toBe(specFile); + + const loadedSpec = await load(specFile); + expect(loadedSpec?.code).toBe('console.log("spec");'); }); }); From 22295396705ed6d221c4024acd13819f42cfd0b0 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Nov 2026 10:43:36 +0000 Subject: [PATCH 4/5] fixup! fix(@angular/build): resolve Vitest artifacts when workspace root is aliased --- .../unit-test/runners/vitest/plugins.ts | 40 +++++++++++-------- .../unit-test/runners/vitest/plugins_spec.ts | 11 ++--- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts index 7632dca9b0d9..af6994df61cc 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts @@ -338,6 +338,21 @@ async function loadResultFile(file: ResultFile): Promise { return readFile(file.source, 'utf-8'); } +function rebasePath(filePath: string, fromRoot: string, toRoot: string): string { + if (path.isAbsolute(filePath)) { + const relativePath = path.relative(fromRoot, filePath); + if ( + relativePath !== '..' && + !relativePath.startsWith('..' + path.sep) && + !path.isAbsolute(relativePath) + ) { + return path.join(toRoot, relativePath); + } + } + + return filePath; +} + export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] { const { workspaceRoot, buildResultFiles, testFileToEntryPoint, setupFiles } = pluginOptions; const isWindows = platform() === 'win32'; @@ -348,20 +363,13 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] ); let vitestConfig: ResolvedConfig | undefined; - const normalizeToWorkspace = (filePath: string): string => { - if (vitestConfig?.root && path.isAbsolute(filePath)) { - const relativeToVitestRoot = path.relative(vitestConfig.root, filePath); - if ( - relativeToVitestRoot !== '..' && - !relativeToVitestRoot.startsWith('..' + path.sep) && - !path.isAbsolute(relativeToVitestRoot) - ) { - return path.join(workspaceRoot, relativeToVitestRoot); - } - } + const normalizeToWorkspace = (filePath: string): string => + vitestConfig?.root ? rebasePath(filePath, vitestConfig.root, workspaceRoot) : filePath; - return filePath; - }; + const normalizeToVitestRoot = (filePath: string): string => + toPosixPath( + vitestConfig?.root ? rebasePath(filePath, workspaceRoot, vitestConfig.root) : filePath, + ); /** The build output path served for a module, whether it is a test entry point or a built artifact. */ const getOutputPath = (id: string): string => { @@ -424,7 +432,7 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] resolveId: (id: string, importer: string | undefined) => { // Fast path for test entry points. if (testFileToEntryPoint.has(id)) { - return id; + return normalizeToVitestRoot(id); } // Workaround for Vitest in Windows when a fully qualified absolute path is provided with @@ -466,13 +474,13 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] fullPath = toPosixPath(fullPath); if (testFileToEntryPoint.has(fullPath)) { - return fullPath; + return normalizeToVitestRoot(fullPath); } // Check if the resolved path corresponds to a known build artifact. const relativePath = path.relative(workspaceRoot, fullPath); if (buildResultFiles.has(toPosixPath(relativePath))) { - return fullPath; + return normalizeToVitestRoot(fullPath); } // If the module cannot be resolved from the build artifacts, let other plugins handle it. diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts index 6102ba91fa69..b097dfb48481 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins_spec.ts @@ -73,17 +73,18 @@ describe('createVitestPlugins', () => { id: string, ) => Promise<{ code: string; map?: unknown } | undefined>; - const expectedSetupId = toPosixPath(path.join(workspaceRoot, 'init-compiler.js')); - const resolvedSetupId = resolveId(`${physicalRoot}/init-compiler.js`, undefined); + const expectedSetupId = `${physicalRoot}/init-compiler.js`; + const resolvedSetupId = resolveId(expectedSetupId, undefined); expect(resolvedSetupId).toBe(expectedSetupId); const loadedSetup = await load(expectedSetupId); expect(loadedSetup?.code).toBe('console.log("init-compiler");'); - const resolvedSpecId = resolveId(`${physicalRoot}/src/app/app.spec.ts`, undefined); - expect(resolvedSpecId).toBe(specFile); + const expectedSpecId = `${physicalRoot}/src/app/app.spec.ts`; + const resolvedSpecId = resolveId(expectedSpecId, undefined); + expect(resolvedSpecId).toBe(expectedSpecId); - const loadedSpec = await load(specFile); + const loadedSpec = await load(expectedSpecId); expect(loadedSpec?.code).toBe('console.log("spec");'); }); }); From e6d76c83a3c279490a66610c4692dfe84b1dcbe6 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:14:39 +0000 Subject: [PATCH 5/5] fixup! fix(@angular/build): resolve Vitest artifacts when workspace root is aliased --- .../unit-test/runners/vitest/plugins.ts | 82 ++++++++----------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts index af6994df61cc..f430c3094b10 100644 --- a/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts +++ b/packages/angular/build/src/builders/unit-test/runners/vitest/plugins.ts @@ -338,61 +338,29 @@ async function loadResultFile(file: ResultFile): Promise { return readFile(file.source, 'utf-8'); } -function rebasePath(filePath: string, fromRoot: string, toRoot: string): string { - if (path.isAbsolute(filePath)) { - const relativePath = path.relative(fromRoot, filePath); - if ( - relativePath !== '..' && - !relativePath.startsWith('..' + path.sep) && - !path.isAbsolute(relativePath) - ) { - return path.join(toRoot, relativePath); - } - } - - return filePath; -} - export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] { - const { workspaceRoot, buildResultFiles, testFileToEntryPoint, setupFiles } = pluginOptions; + const { buildResultFiles, setupFiles } = pluginOptions; + let { workspaceRoot, testFileToEntryPoint } = pluginOptions; const isWindows = platform() === 'win32'; - const setupFileSet = new Set( + let setupFileSet = new Set( setupFiles.map((file) => toPosixPath(path.isAbsolute(file) ? file : path.join(workspaceRoot, file)), ), ); - let vitestConfig: ResolvedConfig | undefined; - - const normalizeToWorkspace = (filePath: string): string => - vitestConfig?.root ? rebasePath(filePath, vitestConfig.root, workspaceRoot) : filePath; - - const normalizeToVitestRoot = (filePath: string): string => - toPosixPath( - vitestConfig?.root ? rebasePath(filePath, workspaceRoot, vitestConfig.root) : filePath, - ); + let vitestConfig: ResolvedConfig; /** The build output path served for a module, whether it is a test entry point or a built artifact. */ const getOutputPath = (id: string): string => { - const normalizedId = toPosixPath(normalizeToWorkspace(id)); - const entryPoint = testFileToEntryPoint.get(normalizedId); + const entryPoint = testFileToEntryPoint.get(id); - return entryPoint - ? entryPoint + '.js' - : toPosixPath(path.relative(workspaceRoot, normalizedId)); + return entryPoint ? entryPoint + '.js' : toPosixPath(path.relative(workspaceRoot, id)); }; // Setup files must not be wrapped in a virtual import stub because Vitest only invalidates // the setup file itself between test files; wrapping it would cause the underlying bundle // to be cached, preventing per-test hooks from running on subsequent test files. - const isCoverageRedirect = (id: string): boolean => { - const normalizedId = toPosixPath(normalizeToWorkspace(id)); - - return ( - !!vitestConfig?.coverage?.enabled && - testFileToEntryPoint.has(normalizedId) && - !setupFileSet.has(normalizedId) - ); - }; + const isCoverageRedirect = (id: string): boolean => + !!vitestConfig?.coverage?.enabled && testFileToEntryPoint.has(id) && !setupFileSet.has(id); return [ { @@ -401,6 +369,29 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] configureVitest(context: VitestPluginContext) { vitestConfig = context.vitest.config; + if (vitestConfig.root && vitestConfig.root !== toPosixPath(workspaceRoot)) { + const previousRoot = workspaceRoot; + workspaceRoot = vitestConfig.root; + testFileToEntryPoint = new Map( + Array.from(testFileToEntryPoint, ([file, entryPoint]) => [ + file.startsWith('angular:') + ? file + : toPosixPath(path.join(workspaceRoot, path.relative(previousRoot, file))), + entryPoint, + ]), + ); + setupFileSet = new Set( + setupFiles.map((file) => + toPosixPath( + path.join( + workspaceRoot, + path.isAbsolute(file) ? path.relative(previousRoot, file) : file, + ), + ), + ), + ); + } + // Vitest keys its file system module cache on the file found on disk. A test entry point is // served from its bundle instead, which also holds the application code it imports, so the // key must follow the served build output, or the cache would return a stale bundle. @@ -432,7 +423,7 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] resolveId: (id: string, importer: string | undefined) => { // Fast path for test entry points. if (testFileToEntryPoint.has(id)) { - return normalizeToVitestRoot(id); + return id; } // Workaround for Vitest in Windows when a fully qualified absolute path is provided with @@ -446,12 +437,9 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] } } - id = normalizeToWorkspace(id); - // Determine the base directory for resolution. let baseDir: string; if (importer) { - importer = toPosixPath(normalizeToWorkspace(importer)); // If the importer is a test entry point, resolve relative to the workspace root. // Otherwise, resolve relative to the importer's directory. baseDir = testFileToEntryPoint.has(importer) ? workspaceRoot : path.dirname(importer); @@ -474,13 +462,13 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] fullPath = toPosixPath(fullPath); if (testFileToEntryPoint.has(fullPath)) { - return normalizeToVitestRoot(fullPath); + return fullPath; } // Check if the resolved path corresponds to a known build artifact. const relativePath = path.relative(workspaceRoot, fullPath); if (buildResultFiles.has(toPosixPath(relativePath))) { - return normalizeToVitestRoot(fullPath); + return fullPath; } // If the module cannot be resolved from the build artifacts, let other plugins handle it. @@ -509,7 +497,7 @@ export function createVitestPlugins(pluginOptions: PluginOptions): Vite.Plugin[] const map = sourceMapText ? JSON.parse(sourceMapText) : undefined; if (map) { - adjustSourcemapSources(map, true, workspaceRoot, toPosixPath(normalizeToWorkspace(id))); + adjustSourcemapSources(map, true, workspaceRoot, id); } return {