diff --git a/test/utils/add-to-package-json.ts b/test/utils/add-to-package-json.ts index 80ad600..ce38b6c 100644 --- a/test/utils/add-to-package-json.ts +++ b/test/utils/add-to-package-json.ts @@ -30,10 +30,20 @@ export const addToPackageJson = async ( ); const installCommand = await getInstallCommand(testDirectory); - try { - await execAsync(installCommand, { cwd: testDirectory }); - } catch (err) { - console.log("ERROR: ", err); + if (await exists(path.resolve(testDirectory, "pnpm-lock.yaml"))) { + try { + await execAsync(`${installCommand} --lockfile-only`, { + cwd: testDirectory, + }); + } catch (err) { + console.log("ERROR: ", err); + } + } else { + try { + await execAsync(installCommand, { cwd: testDirectory }); + } catch (err) { + console.log("ERROR: ", err); + } } await addPackage(testDirectory, depName, packageDetails, licenseFiles);