angular-testing-library icon indicating copy to clipboard operation
angular-testing-library copied to clipboard

Angular 21

Open timdeschryver opened this issue 1 month ago • 2 comments

Update to update 21

timdeschryver avatar Nov 14 '25 18:11 timdeschryver

By no means an extensive evaluation, but in my attempt to use it with v21, the main issue I'm hitting is Uncaught Error: NG0101: ApplicationRef.tick is called recursively thrown, and mainly when providing keyboard input.

Some debugging shows it's coming from waitForWrapper: https://github.com/testing-library/angular-testing-library/blob/d4d45679a1cc4176439b1f4946dae55ae7c0bd98/projects/testing-library/src/lib/testing-library.ts#L592

I'm still on zoned change detection (using provideZoneChangeDetection()).

rdamazio avatar Nov 26 '25 06:11 rdamazio

I didn't encounter any issue with tick, probably because the application is zoneless.

A minor change that I am noticing with respect to routing is that the render promise of components with routes now resolves before an initial redirect completes.

ThiloAschebrock avatar Dec 08 '25 05:12 ThiloAschebrock

Interesting finding with the new vitest which is default in Angular v21 is how configureTestingModule works with non-standalone components: https://github.com/angular/angular/issues/66007 https://github.com/angular/angular/issues/65665

It means that the current implementation of WrapperComponent for inline-template tests won't work as expected since it's not a standalone component.

Probably we should think about migrating this to standalone with this update.

dzonatan avatar Dec 12 '25 11:12 dzonatan

Interesting finding with the new vitest which is default in Angular v21 is how configureTestingModule works with non-standalone components: angular/angular#66007 angular/angular#65665

It means that the current implementation of WrapperComponent for inline-template tests won't work as expected since it's not a standalone component.

Probably we should think about migrating this to standalone with this update.

Yea, I agree. This should become the default in v21.

timdeschryver avatar Dec 12 '25 18:12 timdeschryver

I'm working on a new release, feel free to try it out as @testing-library/angular@beta and provide some feedback here.

If you encounter any issues, please provide a reproduction - or a test case in this repo on the beta branch.

More info can be found at https://github.com/testing-library/angular-testing-library/releases or https://github.com/testing-library/angular-testing-library/pull/559

timdeschryver avatar Dec 16 '25 17:12 timdeschryver

By no means an extensive evaluation, but in my attempt to use it with v21, the main issue I'm hitting is Uncaught Error: NG0101: ApplicationRef.tick is called recursively thrown, and mainly when providing keyboard input.

Some debugging shows it's coming from waitForWrapper:

angular-testing-library/projects/testing-library/src/lib/testing-library.ts

Line 592 in d4d4567

tick(0); I'm still on zoned change detection (using provideZoneChangeDetection()).

@rdamazio I'm unable to reproduce this, can you provide an example please?

timdeschryver avatar Dec 16 '25 18:12 timdeschryver

Interesting finding with the new vitest which is default in Angular v21 is how configureTestingModule works with non-standalone components: angular/angular#66007 angular/angular#65665

It means that the current implementation of WrapperComponent for inline-template tests won't work as expected since it's not a standalone component.

Probably we should think about migrating this to standalone with this update.

@dzonatan can you provide an example please? I'm not encountering any issues with declaring the wrapping component as standalone: false. Funny enough I do get errors when I change this to true.

timdeschryver avatar Dec 16 '25 18:12 timdeschryver