jasmine Questions
4
Solved
jasmine spies on inherited methods (with typescript) not working as expected with toHaveBeenCalled()
I'm currently having an issue when spying on inherited methods for calls in typescript classes, where the toHaveBeenCalled() method is returning false, even though the method being spied upon is ca...
Deianira asked 26/1, 2017 at 8:33
3
Solved
Issue
I have an Angular 9 app and just added a small unit test to a component. But VSCode doesn't recognize the types like describe, beforeEach, it. Although I have a tsconfig.spec.json file which...
Washday asked 24/3, 2020 at 12:16
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
9
I am trying to get a unit test written in Typescript using Jasmine to compile. With the following in my unit-test file, Resharper prompts me with a link to import types from jasmine.d.ts.
/// <...
Shuck asked 16/6, 2015 at 9:22
0
I have recently found out about this blog post about the experimental jest support since angular 16. Based on what I understood I did the following steps:
Installed the following dependencies:
npm ...
Plunger asked 18/12, 2023 at 8:3
4
How to spy on clipboard.copy method?
For
const clipboard = TestBed.inject(Clipboard);
spyOn(clipboard, 'copy').and.returnValue(true);
I get warning that
Argument of type '"copy"' is not ...
7
Solved
I have just started with Unit-Testing, and I have been able to mock my own services and some of Angular and Ionic as well, but no matter what I do ChangeDetectorRef stays the same.
I mean which ki...
Rebato asked 2/1, 2017 at 5:34
6
Solved
I'm trying to add unit tests to my Angular 2 app. In one of my components, there is a button with a (click) handler. When the user clicks the button a function is called which is defined in the .ts...
Brocket asked 17/10, 2016 at 18:13
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
I am new to allure reports and want to generate the allure report. Can anyone help with this?
I am trying with a simple example, my project folder containing config.js and test.js and the allure r...
Kuykendall asked 10/6, 2018 at 11:7
5
In this issue that was recently closed: https://github.com/angular/angular/issues/44186
A contributer (@jessicajaniuk) says
We believe this is resolved by destroyAfterEach: true. If you're seeing ...
Millian asked 7/6, 2022 at 8:27
7
Solved
The Karma test suite fails with the message:
Disconnected, because no message in 10000 ms.
No tests are executed at all.
"@angular/core": "7.1.3",
"jasmine-core": "3.3.0",
"karma-jasmine": "1...
Helm asked 18/2, 2019 at 9:58
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
22
Solved
Currently, I am implementing unit tests for my project and there is a file that contains window.location.href.
I want to mock this to test and here is my sample code:
it("method A should work ...
Tropic asked 3/1, 2019 at 11:2
5
I'm looking for something that generates a boilerplate jasmine test for an angular controller. It seems you could pull the dependencies for the controller out and drop them into the spec and save s...
5
I'm having some issues processing the documentation of Jest, because I expected this code to work:
import Vue from 'vue';
import Router from '@/router/index';
import OrdersService from '@/services...
Lynellelynett asked 30/9, 2018 at 18:51
15
With Jasmine is there a way to test if 2 arrays contain the same elements, but are not necessarily in the same order? ie
array1 = [1,2,3];
array2 = [3,2,1];
expect(array1).toEqualIgnoreOrder(arra...
Serajevo asked 19/8, 2015 at 18:42
21
jasmine: Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
I have an angular service called requestNotificationChannel:
app.factory("requestNotificationChannel", function($rootScope) {
var _DELETE_MESSAGE_ = "_DELETE_MESSAGE_";
function deleteMessage(...
Sacrament asked 24/3, 2014 at 8:48
2
Solved
I have an angular 6 application and I'm using karma + jasmine to run my tests. but when I run ng test I'm getting the following error:
ERROR in error TS2688: Cannot find type definition file for...
Ultranationalism asked 10/12, 2018 at 16:8
5
Solved
I fail to test a component that uses a custom component with ngModel
HTML code looks like this (see more in the repro below)
<custom-control name="formCode" [(ngModel)]="testValue...
Urata asked 23/7, 2019 at 15:58
4
I had working jasmine tests with webpack 3. Now I try to use it with webpack 4 but have some problem with it.
Firstly I had problem with spyOn function.
Error: : myFunction is not declared writ...
Charis asked 14/11, 2019 at 8:40
4
When writing a unit test in Jest or Jasmine when do you use describe?
When do you use it?
I usually do
describe('my beverage', () => {
test('is delicious', () => {
});
});
When is it time ...
11
Solved
I have the following function in a React component:
onUploadStart(file, xhr, formData) {
formData.append('filename', file.name);
formData.append('mimeType', file.type);
}
This is my test that ...
Pareto asked 13/10, 2016 at 10:15
5
I've just finished fixing several warnings on my unit/component tests of my Angular app, that run using ng test (with Karma/Jasmine).
This process can be quite time-consuming as it is not always o...
Indoor asked 6/3, 2020 at 15:22
3
Solved
My Karma installation used to auto-watch - when I saved a .js file, it'd re-run the tests. It's been a couple of months since I did any JavaScript, and now I come to use it again, the auto-watch fe...
Stealthy asked 15/7, 2015 at 11:17
© 2022 - 2024 — McMap. All rights reserved.