Skip to content

Tag: jasmine

How can I force @angular/core to use the latest version of zone.js in its peerDependencies configuration?

This test passes but results in a problem: There is an error that displays when running tests in Jasmine and it falsely indicates test failure: The bug that causes this error is fixed in the latest version of zone.js according to this thread: @angular/core depends on zone.js version 0.11.4 in its peerDependencies which is revealed in package-lock.json: I believe

jasmine.createSpyObj with properties

When mocking dependencies in my Angular tests, I usually create a spy object using jasmine.createSpyObj: then provide it to the TestBed: When I use it in my test, I can then specify the desired return value: Now I also need to mock properties and I cannot find out how it should be done. createSpyObj does allow the definition of property

Conditional test case in jasmine

I am writing Jasmine. I want that when the response from the site is ok (site uploaded- pending 200). Run the it’s (test cases) in spec and when the site is failed to load the site the it’s (test cases) will not run. I check the response from site in before all function. And now in each it that make

How to add custom matchers to jasmine globally?

I’d need a replacement for the jasmine.addMatchers function gone in version 1.3. The current API allows to add matchers to a describe block, but I’d prefer to be able to use my matchers everywhere without adding them again and again. Is there a global way to add own matchers to jasmine 3.1.0? Answer can be used to write matchers