Angular Unit Tests: TypeError: env.catchExceptions is not a function

Viewed 809

I wrote some unit tests for my Angular app, and they all pass when I run ng test, which is great. However, the test is still considered as not successful because of an error thrown at the end:

  An error was thrown in afterAll
  TypeError: env.catchExceptions is not a function

After some research, all I found is this Github issue saying to downgrade to jasmine 2.99, but it did not work for me.

I am using Angular 10, and testing with Jasmine and Karma.

1 Answers

Following the github link, Changing the follow dev dependencies to these versions worked for me when I had the same error.

  • "@types/jasmine": "~2.8.8",
  • "@types/jasminewd2": "~2.0.3",
  • "jasmine-core": "~2.99.1",
  • "jasmine-spec-reporter": "~4.2.1",
  • "karma-jasmine": "~1.1.2",
  • "karma-jasmine-html-reporter": "^0.2.2",

dev dependencies

Related