55 questions
Advice
5
votes
3
replies
995
views
Angular: Vitest vs Jasmine/Karma
I am a bit confused with the Angular testing landscape. I have seen that Vitest will become the new default, replacing Karma. The question I then have is what about Jasmine. Does Vitest replace only ...
Score of 2
1 answer
70 views
Angular number pipe + Jest + Angular testing library. Whitespace is not equal to whitespace?
Can anybody help me to figure this out please ?
Im trying to test a number value in my dom. It is the result of complex calculation.
It is formatted in french locale, cause application is french.
Used ...
Score of 0
1 answer
64 views
Global propery in JSDOM not being set in integration test (angular-testing-library)
I'm not able to set up my testing-library integration tests so they recognize the global interface with the third party static methods from my component library Preline UI
I'm using JSDOM and angular-...
Score of 0
1 answer
130 views
How to render `<ng-container *ngTemplateOutlet="someTemplate" />` when using testing library and MockBuilder?
We use the testing library and MockBuilder from ng-mocks to write unit tests for angular components:
...
<ng-container *ngTemplateOutlet="previewContent" />
...
<!-- Preview ...
Score of 0
1 answer
116 views
Angular -Access route param require input in tests when using using with component input binding
I am using Angular 18 with Angular testing library: my issues is that I am able access route param as required input signal. However when I run the tests that depends on this input it's complaining ...
Score of 0
1 answer
276 views
How to work with Angular Query adapter from Tanstack tests
I am working with Angular Query with Angular v19 and signals. I was able to implement good solution to work with QueryOptions and injectQuery in the app. How ever it's quite challenging to work with ...
Score of 0
1 answer
748 views
Angular Unit testing: How to pass multiple files through include while running ng test from CLI?
I am using ng test to run my unit tests.
I have a scenario where I need to test mutliple spec files which are in different paths.
I am able to do this using angular.json
"test": {
...
"...
Score of -1
1 answer
765 views
BDD based testing framework/library for testing frontend behaviour in Angular?
First of all, I looked at another question,
BDD framework for the frontend. The question has gone on entirely different direction.
BDD is not about Cucumber or Plain english tests names. (Jasmine/...
Score of 0
1 answer
1114 views
testing an Angular component with a ngrx store, not causing actions to be triggered
I have a few angular components that I want to test and make sure that they are working.
The idea of the component in it's simplest form is to list datapoints. Each of these datapoints should be ...
Score of 0
1 answer
462 views
Using Jest/angular-testing-library to test eventEmitter subscription return
I am coding with Angular and am attempting to write a test for the below function. We are not using the built in test and are using Jest with the angular-testing-library. When I run the test, I am not ...
Score of 5
1 answer
1775 views
Angular 14 + Jest - typescript_1.default.canHaveDecorators is not a function
After configuring Jest with Angular 14, I'm getting this error:
Test suite failed to run
TypeError: typescript_1.default.canHaveDecorators is not a function
at TypeScriptReflectionHost....
Score of 0
1 answer
190 views
how can I test a component that have a function that use async await?
I have a problem.
I have a function that use a async await to get data, but in the moment that I try test it. I don't know how to do that.
I tried this
this is my component
async loadTodos() {
try ...
Score of 0
1 answer
88 views
how to get the property of behaivourSubject type property of a service ?, angular testing
I have a service like
export class TestService {
public props: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
props$ = this.props.asObservable();
test(){
}
}
...
Score of 2
1 answer
770 views
The fireEvent.click() from @testing-library/angular not working for 'ion-button' component but works for normal button
I am developing an application with Ionic Angular. While I am testing with @testing-library/angular, the test is not working for ion-button but works for normal button field. What could be the problem?...
Score of 1
1 answer
105 views
Error in tests with Angular 6 and Jest - TypeError: testing.TestBed.inject is not a function
When running the tests on my project when trying to render the component, the tests fail with the following error:
TypeError: testing.TestBed.inject is not a function
This is the test component:
...