@@ -421,6 +421,57 @@ it.layer(
421421 { skip : ! symlinksSupported || windowsHost } ,
422422 ) ;
423423
424+ it . effect . skipIf ( ! symlinksSupported || windowsHost ) (
425+ "keeps configured npm registries' latest versions apart for one install" ,
426+ ( ) =>
427+ Effect . gen ( function * ( ) {
428+ const tempDir = yield * makeTempDir ( "t3-npm-registry-isolation" ) ;
429+ yield * Effect . addFinalizer ( ( ) =>
430+ Effect . sync ( ( ) => NodeFS . rmSync ( tempDir , { recursive : true , force : true } ) ) ,
431+ ) ;
432+ const npmBinDir = NodePath . join ( tempDir , "npm-bin" ) ;
433+ writeExecutable ( NodePath . join ( npmBinDir , "npm" ) ) ;
434+ const binaryPath = linkIntoPackage ( tempDir , "package-tool" , [
435+ "lib" ,
436+ "node_modules" ,
437+ "@example" ,
438+ "package-tool" ,
439+ ] ) ;
440+ let probes = 0 ;
441+ const latest = ( registry : string , version : string ) =>
442+ resolveProviderMaintenanceCapabilitiesEffect ( packageToolUpdate , {
443+ binaryPath,
444+ env : { PATH : npmBinDir , NPM_CONFIG_REGISTRY : registry } ,
445+ } ) . pipe (
446+ Effect . provideService (
447+ ChildProcessSpawner . ChildProcessSpawner ,
448+ stdoutSpawner ( ( ) => {
449+ probes ++ ;
450+ return JSON . stringify ( version ) ;
451+ } ) ,
452+ ) ,
453+ Effect . tap ( ( capabilities ) =>
454+ Effect . sync ( ( ) => {
455+ expect ( capabilities . latestVersionCacheKey ?? "" ) . not . toContain ( "private-token" ) ;
456+ } ) ,
457+ ) ,
458+ Effect . flatMap ( resolveLatestProviderVersion ) ,
459+ ) ;
460+ const first = "https://user:[email protected] " ; 461+ const second = "https://second.example.test" ;
462+ expect ( yield * latest ( first , "1.1.0" ) ) . toBe ( "1.1.0" ) ;
463+ expect ( yield * latest ( second , "2.0.0" ) ) . toBe ( "2.0.0" ) ;
464+ expect ( yield * latest ( first , "1.2.0" ) ) . toBe ( "1.1.0" ) ;
465+ expect ( probes ) . toBe ( 2 ) ;
466+ } ) . pipe (
467+ Effect . provide ( ProviderLatestVersions . layer ) ,
468+ Effect . provideService (
469+ HttpClient . HttpClient ,
470+ HttpClient . make ( ( ) => Effect . die ( "configured registries must not use public npm" ) ) ,
471+ ) ,
472+ ) ,
473+ ) ;
474+
424475 it ( "pins the advertised stable version in a pnpm-global update command" , ( ) => {
425476 const advisoryFor = (
426477 maintenanceCapabilities : ReturnType < typeof makeProviderMaintenanceCapabilities > ,
0 commit comments