@@ -29,6 +29,10 @@ function readNpmConfigList(env: NodeJS.ProcessEnv): Record<string, unknown> {
2929 return JSON . parse ( raw ) as Record < string , unknown > ;
3030}
3131
32+ function expectUnsetNpmJsonConfig ( value : unknown ) : void {
33+ expect ( value == null ) . toBe ( true ) ;
34+ }
35+
3236describe ( "npm project install env" , ( ) => {
3337 it ( "uses an absolute POSIX script shell for npm lifecycle scripts" , ( ) => {
3438 withMockedPlatform ( "linux" , ( ) => {
@@ -294,7 +298,7 @@ describe("npm project install env", () => {
294298
295299 const npmConfig = readNpmConfigList ( env ) ;
296300 expect ( npmConfig . before ) . toBe ( FROZEN_NOW . toISOString ( ) ) ;
297- expect ( npmConfig [ "min-release-age" ] ) . toBeNull ( ) ;
301+ expectUnsetNpmJsonConfig ( npmConfig [ "min-release-age" ] ) ;
298302 } finally {
299303 fsSync . rmSync ( dir , { recursive : true , force : true } ) ;
300304 }
@@ -335,8 +339,8 @@ describe("npm project install env", () => {
335339 expect ( env . npm_config_before ) . toBe ( "" ) ;
336340 expect ( env . npm_config_min_release_age ) . toBe ( "0" ) ;
337341 const npmConfig = readNpmConfigList ( env ) ;
338- expect ( typeof npmConfig . before ) . toBe ( "string" ) ;
339- expect ( npmConfig [ "min-release-age" ] ) . toBeNull ( ) ;
342+ expect ( npmConfig . before == null || typeof npmConfig . before === "string" ) . toBe ( true ) ;
343+ expectUnsetNpmJsonConfig ( npmConfig [ "min-release-age" ] ) ;
340344 } finally {
341345 fsSync . rmSync ( dir , { recursive : true , force : true } ) ;
342346 }
0 commit comments