I am just unable to figure out why test coverage is 0 even though test case is passing. I have a script in package.json:
"nyctest": "node --max_old_space_size=4096 node_modules/nyc/bin/nyc.js --reporter=text mocha"
When I run npm run nyctest
My test pass, but coverage is 0 percent.
Following is the test and the file is it testing:
test.js
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);
var application = require('../../../src/main/resources/static/js/components/app.js');
describe('sample return testing', function(){
it('should return true', function(){
application.sample.returnValue().should.equal(true);
})
});
app.js
const sample = {
returnValue: function () {
return true;
}
};
module.exports = {sample};
Appreciate any help.