Error: The code should be running in the fakeAsync zone to call this function

If you are using the tick function in your spec:

// Wait for async validators
tick(1000);

and getting the following error in your spec:

Error: The code should be running in the fakeAsync zone to call this function

Then you need to change the spec function like this:

  it('shoul oad', fakeAsync(async () => {
  ...
// Wait for async validators
tick(1000);
.....
  }));

Leave a Comment

Your email address will not be published. Required fields are marked *