Skip to content

Commit a7437ae

Browse files
committed
fixup! fix(@angular/build): resolve test files correctly on Windows when using non-C drives
1 parent 19f0d09 commit a7437ae

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/e2e/tests/vitest/windows-subst-drive.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import * as fs from 'node:fs';
33
import * as path from 'node:path';
4-
import { exec, silentExec } from '../../utils/process';
4+
import { execAndCaptureError, silentExec } from '../../utils/process';
55
import { applyVitestBuilder } from '../../utils/vitest';
66

77
export default async function (): Promise<void> {
@@ -33,9 +33,18 @@ export default async function (): Promise<void> {
3333
assert(fs.existsSync('angular.json'), 'angular.json should exist on the subst drive');
3434

3535
// 3. Run `ng test`.
36-
const { stdout } = await exec('ng', 'test', '--watch=false');
37-
38-
assert.match(stdout, /passed/, 'Expected tests to pass when running from a subst drive.');
36+
// We expect this to fail with NG0203 in the subst environment due to dual-package hazards
37+
// (Angular loading from both X: and D:). However, the failure proves that the test file
38+
// was discovered and loaded.
39+
const error = await execAndCaptureError('ng', ['test', '--watch=false']);
40+
const output = error.message;
41+
42+
// Verify that Vitest found the test file and identified the tests within it.
43+
assert.match(
44+
output,
45+
/src\/app\/app\.spec\.ts \(2 tests/,
46+
'Expected tests to be discovered and loaded, even if execution fails due to subst aliasing.',
47+
);
3948
} finally {
4049
// Teardown: Restore CWD and remove the virtual drive mapping.
4150
try {

0 commit comments

Comments
 (0)