How to trace 'Navigation triggered outside Angular zone' to origin, it it's possible

666 views Asked by At

My Angular 11 application triggers this warning in console:

Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'? core.js:27937

Is there a way to trace that warning to the point in my code that might be raising it (assuming the origin is really in my code)?

1

There are 1 answers

1
Casey Plummer On

Not sure what you mean by console. If you're using Jest and its outputting that message to the console, you can use jest-fail-on-console to have the warnings give you better error messages:

https://github.com/ValentinH/jest-fail-on-console#readme

failOnConsole({
  shouldFailOnWarn: true,
});