This allows you to set coverage: true in your TypeScript and Babel options, and get code instrumented by Istanbul. To get the coverage output, then add something like this to your test suite:
after(() => {
if (!('__coverage__' in window)) return;
const { Reporter, Collector } = require('istanbul');
const coll = new Collector();
coll.add(window.__coverage__);
const reporter = new Reporter(null, path.join(__dirname, '..', 'coverage'));
reporter.addAll(['text-summary', 'lcovonly']);
return new Promise((res) => {
reporter.write(coll, false, res);
});
});
This has an advantage in that it works with electron-mocha as well which is v cool.
This allows you to set
coverage: true
in your TypeScript and Babel options, and get code instrumented by Istanbul. To get the coverage output, then add something like this to your test suite:This has an advantage in that it works with electron-mocha as well which is v cool.