@@ -76,6 +76,24 @@ export async function startMockNpmRegistry(...targetPackages: string[]) {
7676 "npm_config_registry" ,
7777 `http://localhost:${ registryPort } `
7878 ) ;
79+ // `pnpm run` exports `npm_config_minimum_release_age` from the workspace
80+ // pnpm-workspace.yaml to subprocess env vars, but does NOT export the
81+ // matching `minimumReleaseAgeExclude` array. Tests using this mock registry
82+ // install freshly-published first-party packages, so the 24h cooldown would
83+ // reject them. Set the exclude list as a comma-separated env var so the
84+ // constraint still applies to other (third-party) deps pulled via uplinks.
85+ const revert_npm_config_minimum_release_age_exclude = overrideProcessEnv (
86+ "npm_config_minimum_release_age_exclude" ,
87+ [
88+ ...pkgs . keys ( ) ,
89+ // workerd and @cloudflare /workers-types are pulled in transitively
90+ // (e.g. via miniflare) and may have been bumped same-day. Keep this
91+ // list in sync with `minimumReleaseAgeExclude` in pnpm-workspace.yaml.
92+ "workerd" ,
93+ "@cloudflare/workerd-*" ,
94+ "@cloudflare/workers-types" ,
95+ ] . join ( "," )
96+ ) ;
7997
8098 if ( debugLog . enabled ) {
8199 debugLog ( "Updated" ) ;
@@ -105,6 +123,7 @@ export async function startMockNpmRegistry(...targetPackages: string[]) {
105123 revert_NPM_CONFIG_USERCONFIG ( ) ;
106124 revert_npm_config_registry ( ) ;
107125 revert_npm_config_userconfig ( ) ;
126+ revert_npm_config_minimum_release_age_exclude ( ) ;
108127 if ( debugLog . enabled ) {
109128 debugLog ( "After" ) ;
110129 debugLog ( execSync ( "pnpm config list" , { encoding : "utf8" } ) ) ;
0 commit comments