13,381 questions
0 votes
0 answers
51 views
Angular 19 Jasmine Test HighContrastModeDetector Error [closed]
We have an enterprise Angular application. It was on v13 and I have upgraded it to v19. The Jasmine tests are okay on v13 but it has error on v19. I get the error shown in the screenshot. I cannot ...
-3 votes
0 answers
40 views
How to include spec file paths in Jasmine test reports
I have a project that uses Jasmine on Node.js. I want the generated test reports to include file paths for each test. Steps to reproduce: npm install --save-dev jasmine npx jasmine init npx jasmine ...
0 votes
1 answer
72 views
jasmine.clock().autoTick() - autoTick is not a function [closed]
Here's the repo. There is a test where I want to use jasmine.clock().autoTick(): fit("show verification field", async () => { jasmine.clock().install(); jasmine.clock()....
0 votes
0 answers
22 views
Firefox WebDriver Fails with "Cyclic object value" Error When Using jasmine-browser-runner with Ext.js 3.2.1
Firefox WebDriver Fails with "Cyclic object value" Error When Using jasmine-browser-runner with Ext.js 3.2.1 Problem Summary jasmine-browser-runner works perfectly with Chrome but fails with ...
0 votes
1 answer
54 views
Writing tests in Jasmine for functions with dependancy on data from remote host whithout making actual fetch request
I apologize beforehand for this post, but I am struggling to figure out how to mock data from fetch request without making request itself and then test functions which have this data as dependency in ...
1 vote
0 answers
61 views
Unable to connect and call Web API from Jasmine test
We have a specific set of tests of our Angular application that requires Jasmine to connect/authenticate and call our ASP.NET Core Web API. As we have numerous UI tests setup (so these are not ...
1 vote
0 answers
50 views
Need to update the mock data in angular test
dataTeamService = jasmine.createSpyObj('DataTeamService',['setDataGroup'],{ selectValGroup: of({ id : 1, accessData : false }) }); it('shoud remove valData when accessData is false',()=>{ fixture....
0 votes
1 answer
93 views
How to properly mock NGXS Select in a component using the Store
I have a component that fetches some information from a NGXS Store, that I need to create unit tests for. The component looks like this: @Component({ standalone: true, selector: 'app-task-...
0 votes
1 answer
49 views
Detect unnecessary imports in tests
Angular's Compiler has the possibility to detect unused standalone imports with the rule NG8113 Unused Standalone Imports. By default those detections are printed as warning. Is there a way to get ...
2 votes
1 answer
258 views
Loading GoogleMaps API in Angular 20 Karma unit tests
Having updated an Angular v19 app to Angular v20, the Google Maps API is not being loaded in the Karma unit tests. All the unit tests on components which serve Google Maps fail with the following ...
0 votes
1 answer
44 views
unit test anchor link in Mat table cell
Trying to unit test, whether a cell is having hyperlink or not. Not able to find the tag a via testHarness api. import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ...
1 vote
1 answer
75 views
Angular Test harness not setting ngModel variable in MatSelect
Using MatSelect and working on UTs. Post selecting a option via test harness, not able to see ngModel variable binding working. Here is the html snippet: <mat-form-field class="dropdown-...
0 votes
1 answer
55 views
Angular unit testing relative RouterLinks
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 ...
1 vote
1 answer
338 views
Angular test case fails with NG0203: inject() must be called from an injection context
I'm testing an Angular 18 standalone component using TestBed and running into this error when the component is initialized during a unit test: Error: NG0203: inject() must be called from an injection ...
2 votes
2 answers
461 views
How to test Angular's output signal?
I have an output signal in my component like this: updatedBook = output<Book>(); ... updateBook(changedBook: Book){ this.updatedBook.emit(changedBook); } In the template I have a binding ...