Karma Complete

Week-long test coverage montage Right into the danger zone Risin’ up to the challenge of our rival Oh darlin’ my heart’s on fire Lose your blues, everybody cut footloose Key takeaways beforeEach does not reset any spy that it sets. Will need to find another approach if this is needed. I think setting testObj from a copy of the target object, then spying on that is enough to avoid problems, but there are instances where spy is being set on the nested test objects directly, which will likely affect the tests for those objects at some point....

March 29, 2018

Stabilizing Tests for Karma Coverage

Loading the canvas libs Now that Karma is all wired up, I can start poking at the tests. The first problem I need to fix involves canvas-libs. knobsAndLevers uses the supporting object in canvas-libs to set a randomized initial spawn interval for the creatures. The usage is: 1 this.spider.initialInterval = supporting.getRandom(this.spider.interval.min, this.spider.interval.max); But knobsAndLevers.init() fails, because supporting is not available: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ node_modules/....

March 28, 2018

Test Coverage with Karma

Adding the Karma Test Coverage Tool I got tired of flailing around in the dark, so after turning on the lights, I started looking into test coverage tools. A few sources recommended Karma, so I went for it. It’s good (sorry). Code Coverage of Jasmine Tests using Istanbul and Karma Capturing browser with Karma 1 npm install karma karma-coverage My config: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 module....

March 27, 2018