From ba8e985da98a28531b234f2d7fd313854535df1b Mon Sep 17 00:00:00 2001 From: Simon Abbott Date: Wed, 22 Jan 2025 18:13:21 -0600 Subject: [PATCH] test(release): test that peer deps don't get broken This is a test commit to try to get the e2e tests to actually run on it. it SHOULD NOT BE MERGED. --- e2e/release/src/lock-file-updates.test.ts | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/e2e/release/src/lock-file-updates.test.ts b/e2e/release/src/lock-file-updates.test.ts index 28fc24633ffe7..9720515500104 100644 --- a/e2e/release/src/lock-file-updates.test.ts +++ b/e2e/release/src/lock-file-updates.test.ts @@ -1,6 +1,8 @@ import { + checkFilesExist, cleanupProject, newProject, + readJson, runCLI, runCommand, uniq, @@ -154,6 +156,42 @@ describe('nx release lock file updates', () => { `); }); + it('should not mess with peer dependencies when package manager is npm', async () => { + initializeProject('npm'); + + updateJson('package.json', (json) => { + json.workspaces = [pkg1, pkg2, pkg3]; + return json; + }); + + updateJson(`${pkg1}/package.json`, (json) => { + json.peerDependencies = { + semver: '^7.3.2', + }; + return json; + }); + + runCommand(`npm install`); + + // Make sure that the peer dependency was installed, and that the lock file + // is up-to-date, otherwise we are testing nothing. + checkFilesExist('node_modules/semver/package.json'); + runCommand('npm ci', { failOnError: true }); + + // workaround for NXC-143 + runCLI('reset'); + + runCommand(`git add .`); + runCommand(`git commit -m "chore: initial commit"`); + + runCLI(`release version 999.9.9`); + + // Make sure that the lock file is still valid, and that the peer dependency + // was not removed. + runCommand('npm ci', { failOnError: true }); + checkFilesExist('node_modules/semver/package.json'); + }); + it('should not update lock file when package manager is yarn classic', async () => { initializeProject('yarn');