Use Karma, Mocha, Chai and Coverage to run headless unit tests and generate lcov code coverage


Reading Time: 3 minutes Github: 1) Install gulp, mocha, chai, puppeteer, http-server as dev-dependencies yarn add gulp mocha chai puppeteer http-server -D 2) Install all karma dependencies as dev-dependencies. yarn add karma karma-chai karma-mocha karma-chrome-launcher mocha chai -D 3) Create test/bootstrap.karma.js file to share global variables among unit test cases. ‘use strict’; const expect = chai.expect; const assert … Read more