Fixing Jasmine “encountered a declaration exception”

If you ever come upon a Jasmine unit test that ends with “encountered a declaration exception”, it’s likely because you have committed a simple, subtle mistake. Every few weeks, I would get that error, and forgetting how I fixed it the previous time, spend another 30 minutes to fix it. Here’s a screenshot of the […]

How to fix “Cannot read property ‘failedExpectations’ of undefined”

While running Karma unit tests, you might run into the following error: Uncaught TypeError: Cannot read property ‘failedExpectations’ of undefined. The cryptic error message might be a pain in the butt to debug, so let me save you some time. In your tests, look for reassignment of the result variable. You are probably overwriting a […]