@@ -14,6 +14,7 @@ import path from 'node:path';
14
14
import { createVirtualModulePlugin } from '../../tools/esbuild/virtual-module-plugin' ;
15
15
import { assertIsError } from '../../utils/error' ;
16
16
import { loadEsmModule } from '../../utils/load-esm' ;
17
+ import { toPosixPath } from '../../utils/path' ;
17
18
import { buildApplicationInternal } from '../application' ;
18
19
import type {
19
20
ApplicationBuilderExtensions ,
@@ -117,7 +118,7 @@ export async function* execute(
117
118
118
119
buildTargetOptions . polyfills = injectTestingPolyfills ( buildTargetOptions . polyfills ) ;
119
120
120
- const outputPath = path . join ( context . workspaceRoot , generateOutputPath ( ) ) ;
121
+ const outputPath = toPosixPath ( path . join ( context . workspaceRoot , generateOutputPath ( ) ) ) ;
121
122
const buildOptions : ApplicationBuilderInternalOptions = {
122
123
...buildTargetOptions ,
123
124
watch : normalizedOptions . watch ,
@@ -156,10 +157,11 @@ export async function* execute(
156
157
`import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';` ,
157
158
'' ,
158
159
normalizedOptions . providersFile
159
- ? `import providers from './${ path
160
- . relative ( projectSourceRoot , normalizedOptions . providersFile )
161
- . replace ( / .[ m c ] ? t s $ / , '' )
162
- . replace ( / \\ / g, '/' ) } '`
160
+ ? `import providers from './${ toPosixPath (
161
+ path
162
+ . relative ( projectSourceRoot , normalizedOptions . providersFile )
163
+ . replace ( / .[ m c ] ? t s $ / , '' ) ,
164
+ ) } '`
163
165
: 'const providers = [];' ,
164
166
'' ,
165
167
// Same as https://github.com/angular/angular/blob/05a03d3f975771bb59c7eefd37c01fa127ee2229/packages/core/testing/src/test_hooks.ts#L21-L29
@@ -406,7 +408,7 @@ function generateCoverageOption(
406
408
return {
407
409
enabled : true ,
408
410
excludeAfterRemap : true ,
409
- include : [ `${ path . relative ( workspaceRoot , outputPath ) } /**` ] ,
411
+ include : [ `${ toPosixPath ( path . relative ( workspaceRoot , outputPath ) ) } /**` ] ,
410
412
// Special handling for `reporter` due to an undefined value causing upstream failures
411
413
...( codeCoverage . reporters
412
414
? ( { reporter : codeCoverage . reporters } satisfies VitestCoverageOption )
0 commit comments