Skip to main content

Questions tagged [testbed]

A testbed is a platform for experimentation of large development projects. Testbeds allow for rigorous, transparent, and replicable testing of new technologies or code in an isolated environment.

0 votes
0 answers
214 views

'inject() must be called from an injection context' in Jest test code after upgrading Angular/Jest

Problem Hi there, I recently upgraded my Angular app from v14 to v17, along with Jest from v27 to v29, and many other dependencies along the way. I was able to get my app working correctly, and fix ...
IMeyers20's user avatar
1 vote
1 answer
42 views

Unit test with TestBed : problem with the interpretation of "params" property of the ActivatedRoute snapshot

I am currently developping a unit test component in Cypress using TestBed for a component which needs to provide an ActivatedRoute with a parameter in the snapshot. I precise that this parameter is ...
user23952260's user avatar
0 votes
0 answers
25 views

How to test an Angular directive method that requires access to an ElementRef of an injected component

I'm working on an Angular application where I have a component that uses a custom directive called ExampleDirective. This directive needs to access a element within the component and perform some ...
camil's user avatar
  • 11
-1 votes
1 answer
76 views

Implement Angular Test with L10nTranslate

I'm trying to implement tests with Karma in an Angular Application. I'm facing an issue beacuse my component uses L10nTranslate so i tried to import the module into my test file My Component @...
Marvin Valke's user avatar
-1 votes
1 answer
145 views

Getting Error Cannot read properties of undefined (reading 'subscribe') in Unit testing

I'm trying to write a Unit test for my component in angular but when it calls an Api it getting undefine from reponse and i don't know how to handle this because it's my first time writing a unit test ...
priyansh kasera's user avatar
1 vote
0 answers
110 views

How to check for the presence of a `mat-error` element in unit tests?

I'm writing unit tests for a form and I'm having problems checking for the presence of mat-errors. I looked it up and found some answered questions( 1 2 3 ) which I tried to incorporate with no ...
Tuma's user avatar
  • 757
0 votes
0 answers
64 views

Update angular from 10.2 to 11. Error - An unhandled exception occurred: Cannot read properties of undefined (reading 'Workspace') when run ng test

This error is returned when running ng test Find this link - https://lightrun.com/answers/angular-schule-angular-cli-ghpages-cannot-read-property-workspace-of-undefined-after-upgrading-to-angular-v11....
Dmitriy's user avatar
1 vote
1 answer
1k views

Spy service never being called in unit test (jasmine angular)

I'm trying to understand why my test doesn't work as expected. Here is the component: @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], ...
ricardo tenorio's user avatar
2 votes
0 answers
588 views

Either my Jest plugin works or my npm run test in Angular 14 project

I'm in an Angular Jest configuration paradoxon please help me. I am using Jest (Orta) plugin in VSCode for my Angular 14 project, but I need to make sure that my test are working fine from the command ...
Bazidoa's user avatar
  • 64
0 votes
1 answer
1k views

Angular error: "1 periodic timer(s) still in the queue." when I use HttpClientTestingModule and Testing Library

In my Angular project, I have decided to remove jasmine and karma and use jest and testing-library. I have decided to apply my test policy under the "case of use" concept. It means: My tests ...
David's user avatar
  • 1
0 votes
0 answers
219 views

Testing Angular Lazy Loaded

There are a lot of old answers that exist on this platform and I have tried them all, but none of them resolved my request. Some methods were deprecated, and I found info that requires to use of ...
Serkan KONAKCI's user avatar
0 votes
1 answer
1k views

How to use a DomSanitizer inside a unit test, if the component does not inject it?

I have a simple component, which does not inject the DomSanitizer. Let's say it is export class ExampleComponent { @Input() public safeHtml: SafeHtml | undefined; } How can I use the ...
MojioMS's user avatar
  • 1,673
4 votes
1 answer
5k views

Property 'configureTestingModule' doesn't exist on type TestBedStatic

I have updated my Angular 12 application to Angular 14 using ng update. The build was successful and can see my application running perfectly fine but my tests are failing. One of the errors I am ...
Aayushi Jain's user avatar
  • 2,879
0 votes
1 answer
173 views

Jmeter thread time series with milliseconds frequency

I am trying to build a test plan in JMeter based on a specific thread time series. For example, I know that at time x, there are n(x) users, and at time x+t, there are n(x+t) users, and so on. The ...
Andrea Pinto's user avatar
0 votes
0 answers
324 views

Angular service test - TestBed ignores one of the mocks

I am having an issue with one of my spy objects - somehow TestBed seems to ignore it at all. The spy for StateService works perfect, but the one for RoutingService keeps failing with: ...
Dandy's user avatar
  • 959

15 30 50 per page
1
2 3 4 5
11