Error: zone-testing.js is needed for the fakeAsync() test helper but could not be found. When running test on Angular webapp using serenityJS+Jasmine

Hello little bit late to answer but I leave the comment here for future reference: ERROR ORIGIN In my case, the error was found in the test.ts file. This file sets the TestBed config that is used by default in Angular spec files when created with the command ng generate component my-component. SOLUTION The fix … Read more

What is the difference between tick() and flush() in angular testing?

They do different things relative to async operations that were previously started. For example; calling setTimeout(…) starts an async operation. tick() moves time forward. flush() moves time to the end. This can be better illustrated with the unit tests for those functions. Tick This unit test shows tick being used to move time forward in … Read more

Angular2, testing and resolved data: How to test ngOnInit?

What is the behavior or the ngOnInit method? All it does is assign the value of the org when the route data is resolved. So that’s all you really need to test. let routeStub; beforeEach(() => { routeStub = { data: null } TestBed.configureTestingModule({ providers: [ { provide: ActivatedRoute, useValue: routeStub } ] }) }) … Read more

What is the difference between fakeAsync and async in Angular testing?

tl;dr In almost all cases, they can be used interchangeably, but using fakeAsync()/tick() combo is preferred unless you need to make an XHR call, in which case you MUST use async()/whenStable() combo, as fakeAsync() does not support XHR calls. For the most part they can be used interchangeably. I can’t think of anything off the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)