Skip to content

Commit 346c3e1

Browse files
committed
fix: normalize drive letter in fixturePath for Windows CI consistency
fixturePath now lowercases the drive letter to match VS Code's Uri.file().fsPath behavior, removing the need for normalPath wrappers.
1 parent 65b23a2 commit 346c3e1

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ jobs:
8383
- name: Install Dependencies
8484
run: npm ci
8585

86-
- name: Debug Windows path casing
87-
if: runner.os == 'Windows'
88-
run: node -e "const p=require('path'); const {URI}=require('vscode-uri'); const d=p.resolve(__dirname); console.log('resolve(__dirname):', d); console.log('Uri.file(d).fsPath:', URI.file(d).fsPath); const f=p.join(d,'src','PHPUnit','__tests__','fixtures'); console.log('fixtures path:', f); console.log('Uri.file(fixtures).fsPath:', URI.file(f).fsPath);"
89-
9086
- name: Run the tests
9187
run: npm run vitest
9288

src/PHPUnit/__tests__/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { PHPUnitXML } from '../PHPUnitXML';
44
import { TestParser } from '../TestParser/TestParser';
55
import { type TestDefinition, TestType } from '../types';
66

7-
export const fixturePath = (uri: string) => join(__dirname, 'fixtures', uri);
7+
export const fixturePath = (uri: string) =>
8+
join(__dirname, 'fixtures', uri).replace(/^\w:/, (m) => m.toLowerCase());
89
export const phpUnitProject = (uri: string) => fixturePath(join('phpunit-stub', uri));
910
export const phpUnitProjectWin = (path: string) =>
1011
`C:\\vscode\\${path}`.replace(/\//g, '\\').replace(/\\$/g, '');

src/extension.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
detectParatestStubs,
2626
detectPestStubs,
2727
detectPhpUnitStubs,
28-
normalPath,
2928
pestProject,
3029
phpUnitProject,
3130
} from './PHPUnit/__tests__/utils';
@@ -143,7 +142,7 @@ describe('Extension Test', () => {
143142
setWorkspaceFolders([{ index: 0, name: 'phpunit', uri: Uri.file(root) }]);
144143
setTextDocuments(globTextDocuments('**/*Test.php', { cwd: root }));
145144
(context.subscriptions.push as unknown as Mock).mockReset();
146-
cwd = normalPath(root);
145+
cwd = root;
147146
const configuration = workspace.getConfiguration('phpunit');
148147
await configuration.update('php', phpBinary);
149148
await configuration.update('phpunit', phpunitBinary);
@@ -371,7 +370,7 @@ describe('Extension Test', () => {
371370
expectSpawnCalled([
372371
binary,
373372
'--group=integration',
374-
normalPath(phpUnitProject('tests/AttributeTest.php')),
373+
phpUnitProject('tests/AttributeTest.php'),
375374
'--colors=never',
376375
'--teamcity',
377376
]);
@@ -383,7 +382,7 @@ describe('Extension Test', () => {
383382
expectSpawnCalled([
384383
binary,
385384
filterPattern('test_passed'),
386-
normalPath(phpUnitProject('tests/AssertionsTest.php')),
385+
phpUnitProject('tests/AssertionsTest.php'),
387386
'--colors=never',
388387
'--teamcity',
389388
]);
@@ -401,7 +400,7 @@ describe('Extension Test', () => {
401400
expectSpawnCalled([
402401
binary,
403402
filterPattern('test_passed'),
404-
normalPath(phpUnitProject('tests/AssertionsTest.php')),
403+
phpUnitProject('tests/AssertionsTest.php'),
405404
'--colors=never',
406405
'--teamcity',
407406
]);
@@ -464,7 +463,7 @@ describe('Extension Test', () => {
464463

465464
expectSpawnCalled([
466465
binary,
467-
normalPath(phpUnitProject('tests/AssertionsTest.php')),
466+
phpUnitProject('tests/AssertionsTest.php'),
468467
'--colors=never',
469468
'--teamcity',
470469
]);
@@ -482,7 +481,7 @@ describe('Extension Test', () => {
482481
expectSpawnCalled([
483482
binary,
484483
filterPattern('test_passed'),
485-
normalPath(phpUnitProject('tests/AssertionsTest.php')),
484+
phpUnitProject('tests/AssertionsTest.php'),
486485
'--colors=never',
487486
'--teamcity',
488487
]);
@@ -559,7 +558,7 @@ describe('Extension Test', () => {
559558
expectSpawnCalled([
560559
binary,
561560
filterPattern(method),
562-
normalPath(phpUnitProject('tests/AssertionsTest.php')),
561+
phpUnitProject('tests/AssertionsTest.php'),
563562
'--colors=never',
564563
'--teamcity',
565564
'--functional',

0 commit comments

Comments
 (0)