@@ -32,29 +32,29 @@ const pnpmFixtureDir = path.join(fixtureBaseDir, PNPM)
3232
3333async function revertFixtureChanges ( ) {
3434 // Reset only the package.json and pnpm-lock.yaml files that tests modify.
35+ const cwd = process . cwd ( )
36+ // Git needs the paths relative to the repository root.
37+ const relativePackageJson = path . relative (
38+ cwd ,
39+ path . join ( pnpmFixtureDir , PACKAGE_JSON ) ,
40+ )
41+ const relativePnpmLock = path . relative (
42+ cwd ,
43+ path . join ( pnpmFixtureDir , PNPM_LOCK_YAML ) ,
44+ )
45+ // Silently ignore errors. Files may not be tracked by git, may already be
46+ // reverted, or may not have been modified yet. This is expected behavior
47+ // in CI environments and during initial test runs.
3548 try {
36- // Git needs the paths relative to the repository root.
37- const relativePackageJson = path . relative (
38- process . cwd ( ) ,
39- path . join ( pnpmFixtureDir , PACKAGE_JSON ) ,
40- )
41- const relativePnpmLock = path . relative (
42- process . cwd ( ) ,
43- path . join ( pnpmFixtureDir , PNPM_LOCK_YAML ) ,
44- )
45-
4649 await spawn (
4750 'git' ,
4851 [ 'checkout' , 'HEAD' , '--' , relativePackageJson , relativePnpmLock ] ,
4952 {
50- cwd : process . cwd ( ) ,
53+ cwd,
5154 stdio : 'ignore' ,
5255 } ,
5356 )
54- } catch ( e ) {
55- // Log warning but continue - files may already be reverted or not modified.
56- logger . warn ( 'Failed to revert fixture changes:' , e )
57- }
57+ } catch { }
5858}
5959
6060async function createTempFixture ( sourceDir : string ) : Promise < string > {
0 commit comments