Skip to main content
1 vote
0 answers
2k views

I'm trying to unit test one of my components which has regexCtrl = input.required<FormControl<string>>({alias: 'regex'}); After some Googling, this was, more or less, what I thing should ...
1 vote
1 answer
55 views

Running this unit test in Angular 21 always fails with the following error: × should toggle showSettings when settings button is clicked (440231 ms) ● DrawerComponent › should launch settings ...
8 votes
2 answers
2k views

I have generated a fresh Angular 18 project and made it zoneless. It works fine, however in all of my unit tests I am now getting the following error: Error: NG0908: In this configuration Angular ...
98 votes
5 answers
103k views

There is an option in .angular-cli.json to disable the automatic creating of *.spec files e.g. for components, see json schema. This is a really nice feature because personally (this is just my ...
-1 votes
1 answer
750 views

I have an application, which was generated with Angular CLI v19 and uses the application builder. The application builds and works perfectly fine, however when running ng test, I get a new error: ...
0 votes
1 answer
55 views

In my Angular app I need to be able to unit test that routerLink create the correct href attribute. Sometimes they are links relative to the current route, and sometimes they are absolute links from ...
3 votes
1 answer
1k views

I have a Service which contains a resource (for a list of country-objects). Unit-testing the usual way seems not to work, even with fakeAsync and tick. Changes on the Subject which feeds the request-...
0 votes
0 answers
35 views

I have a simple Angular 19 component that will make multiple requests for SVG files, and then insert them into a component @Component({ selector: 'app-custom-svg-images', imports: [AsyncPipe], ...
8 votes
5 answers
2k views

After updating, my previously passing unit tests now fail with the error: 'TypeError: this._renderer.addClass is not a function' across multiple tests, despite not using or importing the renderer in ...
0 votes
0 answers
120 views

I am getting following error when ran the unit tests in pipeline for an Angular app. Error: Timeout - Async function did not complete within 5000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL) ...
1 vote
0 answers
75 views

I am trying to create unit test case for the below code, export class TestService { currentContent$ = this.getContent().pipe( distinctUntilChanged((p, c) => isEqual(p, c)) ); ...
3 votes
1 answer
1k views

I am using Angular's signal queries (viewChild, viewChildren, contentChild, contentChildren) like the following: export class MyComponent { myScrollContainer = viewChild('scrollContainer', { read: ...
0 votes
1 answer
407 views

I am trying to test mat snackbar. I have following code in my component.ts snackbarRef: MatSnackBarRef<TextOnlySnackBar>; constructor(private snackBar: MatSnackBar) {} onUpdate(){ this....
2 votes
1 answer
1k views

After updating my Angular project (including Angular Material) to v19, I am getting new errors like the following in my unit tests: NullInjectorError: R3InjectorError(Standalone[MyComponent])[...
1 vote
1 answer
292 views

I'm facing this error when I try to run test in an Angular project: NavigationMainComponent › should create TypeError: Cannot read properties of undefined (reading 'subscribe') at ...

15 30 50 per page
1
2 3 4 5
19