@@ -336,18 +336,19 @@ describe('@schematics/update', () => {
336336 expect ( resultTreeContent . endsWith ( '}' ) ) . toBeTrue ( ) ;
337337 } ) ;
338338
339- it ( 'skips packages that cannot be fetched from the registry and continues updating others ' , async ( ) => {
339+ it ( 'continues updating others when one package fetch fails ' , async ( ) => {
340340 // Regression test for https://github.com/angular/angular-cli/issues/28834
341341 // Packages from private registries, JSR, AWS CodeArtifact, or local workspaces
342342 // may resolve as npm-registry packages (pass isPkgFromRegistry) but fail to fetch
343- // with a 404. The schematic should warn and skip them rather than hard-failing.
343+ // with a 404. The schematic should warn and skip them rather than hard-failing,
344+ // and other explicitly-requested packages should still be updated.
344345 const inputTree = new UnitTestTree (
345346 new HostTree (
346347 new virtualFs . test . TestHost ( {
347348 '/package.json' : JSON . stringify ( {
348349 name : 'blah' ,
349350 dependencies : {
350- // A real package that can be updated:
351+ // A real package that should be updated:
351352 '@angular-devkit-tests/update-base' : '1.0.0' ,
352353 // A scoped package that does not exist on the npm registry (simulates a
353354 // private / JSR / CodeArtifact package that passes the registry specifier
@@ -363,18 +364,22 @@ describe('@schematics/update', () => {
363364 schematicRunner . logger . subscribe ( ( x ) => messages . push ( x . message ) ) ;
364365
365366 // Should NOT throw even though one package cannot be fetched.
366- const resultTree = await schematicRunner . runSchematic ( 'update' , undefined , inputTree ) ;
367+ const resultTree = await schematicRunner . runSchematic (
368+ 'update' ,
369+ { packages : [ '@angular-devkit-tests/update-base' ] } ,
370+ inputTree ,
371+ ) ;
367372
368- // The unfetchable package should be warned about .
373+ // The unfetchable package should produce a warning .
369374 expect (
370375 messages . some ( ( m ) => m . includes ( '@private-nonexistent/package-ng-update-issue-28834' ) ) ,
371376 ) . toBeTrue ( ) ;
372377
373- // The package.json should be unchanged (nothing to update in no-packages mode) .
378+ // The valid package should have been updated despite the other package failing .
374379 const { dependencies } = resultTree . readJson ( '/package.json' ) as {
375380 dependencies : Record < string , string > ;
376381 } ;
377- expect ( dependencies [ '@angular-devkit-tests/update-base' ] ) . toBe ( '1.0 .0' ) ;
382+ expect ( dependencies [ '@angular-devkit-tests/update-base' ] ) . toBe ( '1.1 .0' ) ;
378383 expect ( dependencies [ '@private-nonexistent/package-ng-update-issue-28834' ] ) . toBe ( '1.0.0' ) ;
379384 } , 45000 ) ;
380385
0 commit comments