Skip to content

Commit

Permalink
fix: rangeStrategy=replace with lockedVersion (#9634)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Apr 20, 2021
1 parent b85f297 commit 9a30604
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/workers/repository/process/lookup/index.spec.ts
Expand Up @@ -347,6 +347,15 @@ describe(getName(__filename), () => {
nock('https://registry.npmjs.org').get('/q').reply(200, qJson);
expect((await lookup.lookupUpdates(config)).updates).toHaveLength(0);
});
it('ignores minor ranged versions when locked', async () => {
config.rangeStrategy = 'replace';
config.currentValue = '^1.0.0';
config.lockedVersion = '1.1.0';
config.depName = 'q';
config.datasource = datasourceNpmId;
nock('https://registry.npmjs.org').get('/q').reply(200, qJson);
expect((await lookup.lookupUpdates(config)).updates).toHaveLength(0);
});
it('upgrades tilde ranges', async () => {
config.rangeStrategy = 'pin';
config.currentValue = '~1.3.0';
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/process/lookup/index.ts
Expand Up @@ -138,7 +138,6 @@ export async function lookupUpdates(
.filter((release) => !release.isDeprecated)
.map((release) => release.version);
const currentVersion =
lockedVersion ||
getCurrentVersion(
config,
versioning,
Expand Down Expand Up @@ -290,6 +289,7 @@ export async function lookupUpdates(

// Record if the dep is fixed to a version
if (lockedVersion) {
res.currentVersion = lockedVersion;
res.fixedVersion = lockedVersion;
} else if (currentValue && versioning.isSingleVersion(currentValue)) {
res.fixedVersion = currentValue.replace(/^=+/, '');
Expand Down

0 comments on commit 9a30604

Please sign in to comment.