karma-jasmine

configure jasmine to not run tests randomly

痞子三分冷 提交于 2020-08-27 05:30:27
问题 i just upgraded to jasmine 3.3 and now my tests by default run in random order. Is there a way to configure karma and jasmine to make tests run like they used to before upgrading to this new version? 回答1: In Karma config under client: you are supposed to be able to set jasmine:{random:false} but that does not work for me. Does it for you? See below link from docs and screen cap. https://github.com/karma-runner/karma-jasmine 来源: https://stackoverflow.com/questions/53086722/configure-jasmine-to

Mock Idle in Angular 4 Unit tests

二次信任 提交于 2020-08-26 02:51:09
问题 I am trying to write unit tests for Angular4 app using karma after this I am getting error at TestBed.createComponent(ServicesComponent) so none of the test cases are being executed, and TypeError: this.expiry.last is not a function at Idle.Array.concat.Idle.watch... There is a lot of stuff written in the constructor(in which there are service calls being made and also Idle functionality was written), How would the test cases should be written for that? This is my spec file, Idle functions

Error: Expected one matching request for criteria “Match by function: ”, found none

你。 提交于 2020-08-07 05:45:38
问题 I have a userService.spec.ts file that I want to test.The code goes this way. It calls a get function that calls the ADMIN_API_URL .I tried testing the given file but got an error that is mentioned in the title. My user.service.spec.ts file. describe('Service: User service', () => { let httpMock: HttpTestingController; let userService: UserService; let url: string; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [ { provide: AUTH_API_URL,