Skip to content

Commit

Permalink
Merge pull request #233 from ghiscoding/bugfix/version-unit-test
Browse files Browse the repository at this point in the history
fix(version): `--sync-workspace-lock` flag no longer work because of pnpm regression
  • Loading branch information
ghiscoding committed Jun 29, 2022
2 parents ec19b73 + 95fff96 commit 414921d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('run install lockfile-only', () => {

const lockFileOutput = await runInstallLockFileOnly('pnpm', cwd);

expect(execSpy).toHaveBeenCalledWith('pnpm', ['install', '--lockfile-only'], { cwd });
expect(execSpy).toHaveBeenCalledWith('pnpm', ['install', '--lockfile-only', '--fix-lockfile'], { cwd });
expect(lockFileOutput).toBe('pnpm-lock.yaml');
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/version/src/__tests__/version-command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ describe('VersionCommand', () => {
expect(changedFiles).not.toContain('package-lock.json');
});

it.skip(`should call runInstallLockFileOnly() when --sync-workspace-lock is provided and expect lockfile to be added to git`, async () => {
it(`should call runInstallLockFileOnly() when --sync-workspace-lock is provided and expect lockfile to be added to git`, async () => {
const cwd = await initFixture('lockfile-pnpm');
await new VersionCommand(
createArgv(cwd, '--bump', 'major', '--yes', '--sync-workspace-lock', '--npm-client', 'pnpm')
Expand All @@ -903,7 +903,7 @@ describe('VersionCommand', () => {
expect(importers['packages/package-4'].specifiers['@my-workspace/package-2']).toBe('workspace:~');
});

it.skip(`should call runInstallLockFileOnly() when --sync-workspace-lock is provided and expect lockfile to be added to git even without npmClient`, async () => {
it(`should call runInstallLockFileOnly() when --sync-workspace-lock is provided and expect lockfile to be added to git even without npmClient`, async () => {
const cwd = await initFixture('lockfile-pnpm');
await new VersionCommand(createArgv(cwd, '--bump', 'minor', '--yes', '--sync-workspace-lock'));

Expand Down
2 changes: 1 addition & 1 deletion packages/version/src/lib/update-lockfile-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export async function runInstallLockFileOnly(
inputLockfileName = 'pnpm-lock.yaml';
if (await validateFileExists(path.join(cwd, inputLockfileName))) {
log.verbose('lock', `updating lock file via "pnpm install --lockfile-only"`);
await exec('pnpm', ['install', '--lockfile-only'], { cwd });
await exec('pnpm', ['install', '--lockfile-only', '--fix-lockfile'], { cwd });
outputLockfileName = inputLockfileName;
}
break;
Expand Down

0 comments on commit 414921d

Please sign in to comment.