diff --git a/exec/commands/src/dlx.ts b/exec/commands/src/dlx.ts index c2b6a10932..daa0992c45 100644 --- a/exec/commands/src/dlx.ts +++ b/exec/commands/src/dlx.ts @@ -106,6 +106,7 @@ export async function handler ( configByUri: opts.configByUri, fullMetadata, filterMetadata: fullMetadata, + strictPublishedByCheck: Boolean(opts.minimumReleaseAge) && opts.minimumReleaseAgeLoose === false, retry: { factor: opts.fetchRetryFactor, maxTimeout: opts.fetchRetryMaxtimeout, diff --git a/installing/commands/test/add.ts b/installing/commands/test/add.ts index c0a670fc8e..77597c8895 100644 --- a/installing/commands/test/add.ts +++ b/installing/commands/test/add.ts @@ -367,7 +367,7 @@ test('add: fail trying to install @pnpm/exe', async () => { expect(err.code).toBe('ERR_PNPM_GLOBAL_PNPM_INSTALL') }) -test('minimumReleaseAge makes install fail if there is no version that was published before the cutoff', async () => { +test('minimumReleaseAge with minimumReleaseAgeLoose disabled makes install fail if there is no version that was published before the cutoff', async () => { prepareEmpty() const isOdd011ReleaseDate = new Date(2016, 11, 7 - 2) // 0.1.1 was released at 2016-12-07T07:18:01.205Z diff --git a/installing/deps-installer/test/install/minimumReleaseAge.ts b/installing/deps-installer/test/install/minimumReleaseAge.ts index fc8a0fe593..e32706fb86 100644 --- a/installing/deps-installer/test/install/minimumReleaseAge.ts +++ b/installing/deps-installer/test/install/minimumReleaseAge.ts @@ -66,11 +66,13 @@ test('minimumReleaseAge applies to versions not in minimumReleaseAgeExclude', as test('minimumReleaseAgeLoose falls back to immature version when no mature version satisfies the range', async () => { prepareEmpty() - // With loose mode (default), falls back to installing an immature version + // With loose mode (default), falls back to installing an immature version. + // The fallback picks the lowest matching version (0.1.0), which differs from + // normal resolution without minimumReleaseAge that would pick the highest (0.1.2). const opts = testDefaults({ minimumReleaseAge: allImmatureMinimumReleaseAge }) const { updatedManifest: manifest } = await addDependenciesToPackage({}, ['is-odd@0.1'], opts) - expect(manifest.dependencies!['is-odd']).toBeTruthy() + expect(manifest.dependencies!['is-odd']).toBe('~0.1.0') }) test('minimumReleaseAge throws when no mature version satisfies the range and loose mode is disabled', async () => {