mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-26 18:09:06 -04:00
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:
@@ -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'], {
|
||||
|
||||
Reference in New Issue
Block a user