Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(release): test that peer deps don't get broken #29727

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions e2e/release/src/lock-file-updates.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
checkFilesExist,
cleanupProject,
newProject,
readJson,
runCLI,
runCommand,
uniq,
Expand Down Expand Up @@ -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');

Expand Down