Skip to content

Instantly share code, notes, and snippets.

@shakthimaan
Created August 5, 2016 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakthimaan/397e674632e6a2513fe2767039fd1f52 to your computer and use it in GitHub Desktop.
Save shakthimaan/397e674632e6a2513fe2767039fd1f52 to your computer and use it in GitHub Desktop.
istanbul mocha coverage still shows code as not executed
process.on('exit', () => { // Runs, but coverage report marks these lines as not executed!
log.info('Start !!!');
c.close();
b.close();
a.stop();
log.info('Exit !!!');
});
describe('process', () => {
context('exit', () => {
let save, spy;
before(() => {
save = sinon.stub(process, 'on').withArgs('exit');
spy = sinon.spy(log, 'info');
});
after(() => {
log.info.restore();
process.on.restore();
});
it('must exit', () => {
save.yields(process.emit('exit'));
expect(spy.callCount).to.be.equal(2);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment