test(dlx): respect minimumReleaseAge from pnpm-workspace.yaml

Integration test for #11183 — verifies that pnpm dlx, invoked via the
bundled CLI, picks up minimumReleaseAge from the project's
pnpm-workspace.yaml and rejects packages that don't meet the cutoff.

Uses the public npm registry (matching the existing minimumReleaseAge
tests in exec/commands/test/dlx.e2e.ts:391) because verdaccio includes
the 'time' field in abbreviated metadata, which short-circuits the
publish-date check.

https://claude.ai/code/session_01NumMLsTvswMVJpbWp3YJrH
This commit is contained in:
Claude
2026-04-15 13:42:58 +00:00
parent a4e4aac9a6
commit 6bc965bff9

View File

@@ -8,6 +8,7 @@ import { prepare, prepareEmpty } from '@pnpm/prepare'
import { addUser, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import type { BaseManifest } from '@pnpm/types'
import PATH_NAME from 'path-name'
import { writeYamlFileSync } from 'write-yaml-file'
import { execPnpm, execPnpmSync } from './utils/index.js'
@@ -81,6 +82,24 @@ patchedDependencies:
})
})
test('dlx respects minimumReleaseAge from pnpm-workspace.yaml', () => {
prepare()
writeYamlFileSync('pnpm-workspace.yaml', {
minimumReleaseAge: 60 * 24 * 10000,
minimumReleaseAgeStrict: true,
})
// Must use the public registry instead of verdaccio — verdaccio includes
// the 'time' field in abbreviated metadata, which short-circuits the check.
const result = execPnpmSync([
'--config.registry=https://registry.npmjs.org/',
'dlx', 'shx@0.3.4', 'echo', 'hi',
])
expect(result.status).toBe(1)
expect(result.stderr.toString()).toMatch(/does not meet the minimumReleaseAge constraint/)
})
test('dlx should work with pnpm_config_save_dev env variable', async () => {
prepareEmpty()
execPnpmSync(['dlx', '@foo/touch-file-one-bin@latest'], {