karma-jasmine Questions

2

Solved

I am new to Jasmine with Angular 2, I am frequently working with the TestBed object when writting a Testcase and getting the error:Please call "TestBed.compileComponents" before your test. How do...
Harrietteharrigan asked 6/10, 2016 at 6:10

3

I have a simple component that handle paste event into a form input. The form: this.searchForm = this.formBuilder.group({ query: [ null, [Validators.required] ] }); onPaste(event) { event.prev...
Eldoria asked 8/12, 2017 at 13:46

4

Solved

My code includes an if block like this Service: import { isDevMode } from '@angular/core'; export class MyService { constructor() {} methodToTest(): { if (!isDevMode()) { doSomething(); } ...
Halfcock asked 17/7, 2018 at 21:37

2

How to correctly unit test (Karma, Jasmine), that emmisions of valueChanges dispatches a FormUpdated action? beforeEach(async(() => { TestBed.configureTestingModule({ imports: [...], provide...
Fortify asked 17/10, 2018 at 14:7

4

Solved

I have a component A that use a component B,c,D in its template: ###template-compA.html <comp-b></comp-b> <comp-c [myinput]="obj.myinput"></comp-c> <comp-d ></...
Bes asked 22/3, 2017 at 11:35

3

Solved

My Angular 17 application with Angular Material throws an error when I run ng test: Chrome 121.0.0.0 (Linux x86_64) AppComponent should have the 'app-test' title FAILED Error: NG05105: Unexpected ...
Bronchiole asked 24/1, 2024 at 17:22

2

I have created a new angular app v13 using cli with the defaults. I replaced the app.component.html file to display 4 images. This loads in the browser fine doing npm start. When I run npm test and...
Pastoralize asked 26/2, 2022 at 22:31

6

Solved

I m new to angular 4 and trying to test one of the angular 4 feature router.paramMap from unit tests, Reading route params in fallowing way and working as expected in my application. constructor(p...
Monosymmetric asked 19/10, 2017 at 5:11

4

I'm getting this Coverage Summary =============================== Coverage summary =============================== Statements : Unknown% ( 0/0 ) Branches : Unknown% ( 0/0 ) Functions : Unknown% (...

2

Solved

I have a simple component: .html: <h1> {{title}} </h1> <button (click)="changeTitle()">Change title</button> .ts: export class AppComponent { title = 'app works!'; ...
Illtempered asked 27/6, 2017 at 9:17

3

Solved

I want to get cobertura and html output from the karma coverage reporter. At the moment I have to run the tests twice. One time with this configuration: reporters: ['progress', 'coverage'] coverag...
Gwenny asked 25/9, 2014 at 12:0

3

I am writing unit tests for my component but having trouble in creating the instance of the component and showing following error, TypeError: Cannot read property 'patientId' of null  I have tr...
Bernadettebernadina asked 5/11, 2019 at 13:10

6

Solved

Im writing a code with in angular with ChangeDetectorRef The function itself is working fine. getVersionInfos() { concat( of( this.getApiSubs = this.aboutInfoService.getApiVersion().subscribe((da...
Executor asked 14/1, 2021 at 1:21

0

For some time, I've been banging my head with running a pretty straightforward (close to a freshly bootstrapped Aurelia project) configuration. I have a problem launching any tests, and the Chrome ...
Lycanthropy asked 8/3, 2024 at 12:22

3

Solved

I am using the Angular 4 CLI (v.1.0.0) and to handle testing I created some mocks that use jasmine to create a spy. In the IDE everything looks okay, however in the terminal I am getting and error ...
Cassella asked 21/4, 2017 at 20:49

2

In Angular project (Angular CLI: 9.1.4) I have a component with has function using window.location.href = EXTERNAL_URL a.component.ts import { Component, OnInit } from '@angular/core'; import { Ser...
Iover asked 15/7, 2021 at 8:12

2

I am using angular cli version 1.4.5 and below is the karma.conf.ts file module.exports = function (config) { config.set({ basePath: '', exclude: [ "src/app/components/panel/panel.component.sp...
Pointillism asked 6/2, 2018 at 7:20

4

Solved

Angular 4 unit test for a subscribe. I want to test that my subscribe returns an array of Users. I want to mock a list of users and test a function called getUsers. The subscribe unit test doesnt...
Ysabel asked 23/8, 2017 at 12:38

4

I want to import certain modules for all testing suits such as ngrx Store, ngx translate or httpClientModule in an [email protected] project with angular 5. in the generated test.ts I have ad...
Callow asked 9/11, 2017 at 14:30

2

Solved

I was making my spec file and setting but sometimes this error appears in the console 'An error was thrown in afterAll TypeError: Cannot read properties of undefined (reading 'toLowerCase')', Why d...
Garrulity asked 11/8, 2021 at 15:23

22

Solved

I just upgraded from Angular 2 rc4 to rc6 and having troubles doing so. I see the following error on my console: Unhandled Promise rejection: Template parse errors: 'cl-header' is not a known e...
Hanser asked 10/9, 2016 at 16:22

2

Solved

I'm working in an Angular Project that is tested with Karma/Jasmine. Angular tests, by default, run in a randomized order, which may result a test failing if ran in a certain order. I've noticed th...
Selves asked 15/8, 2020 at 21:12

5

I have a LoginView component in which I have Angular Material Tabs. In one tab there's a LoginForm component displayed and in a second tab there's a RegistrationForm component. What I try to test ...
Schmid asked 21/9, 2018 at 15:20

3

Solved

I have an effect that returns an EMPTY Observable in one case. I am trying to test this case, but I cant seem to figure out how to test EMPTY Observable? My code is as follows: The effect: effect$...
Bakker asked 23/2, 2021 at 11:28

6

Solved

I'm having modal service to open, confirm and close dialog and i am making its unit test file but i got and error on Angular and this is the code. modal.service.ts @Injectable() export class Moda...
Millar asked 25/10, 2018 at 15:58

© 2022 - 2025 — McMap. All rights reserved.