diff --git a/test/integration/image-optimizer/test/old-sharp.test.ts b/test/integration/image-optimizer/test/old-sharp.test.ts index c7058b89ff1f7..0f16eba78a17a 100644 --- a/test/integration/image-optimizer/test/old-sharp.test.ts +++ b/test/integration/image-optimizer/test/old-sharp.test.ts @@ -8,10 +8,12 @@ const imagesDir = join(appDir, '.next', 'cache', 'images') describe('with outdated sharp', () => { beforeAll(async () => { - await execa('yarn', ['init', '-y'], { - cwd: appDir, - stdio: 'inherit', - }) + await fs.writeFile( + join(appDir, 'package.json'), + JSON.stringify({ + packageManager: 'yarn@1.22.19', + }) + ) await execa('yarn', ['add', 'sharp@0.26.3'], { cwd: appDir, stdio: 'inherit', diff --git a/test/integration/image-optimizer/test/sharp.test.ts b/test/integration/image-optimizer/test/sharp.test.ts index 27105a870edd8..6adb74221122a 100644 --- a/test/integration/image-optimizer/test/sharp.test.ts +++ b/test/integration/image-optimizer/test/sharp.test.ts @@ -8,10 +8,12 @@ const imagesDir = join(appDir, '.next', 'cache', 'images') describe('with latest sharp', () => { beforeAll(async () => { - await execa('yarn', ['init', '-y'], { - cwd: appDir, - stdio: 'inherit', - }) + await fs.writeFile( + join(appDir, 'package.json'), + JSON.stringify({ + packageManager: 'yarn@1.22.19', + }) + ) await execa('yarn', ['add', 'sharp'], { cwd: appDir, stdio: 'inherit',