Closed queicherius closed 7 years ago
I am trying to test async functions. The tests work, but the function gets ignored in the code coverage.
Code:
async function foo () { return 'bar' } module.exports = foo
Test:
const expect = require('chai').expect const module = require('../src/test.js') describe('test', () => { it('generates code coverage', async () => { let c = await module() expect(c).to.equal('bar') }) })
Test command:
./node_modules/babel-cli/bin/babel-node.js ./node_modules/.bin/isparta cover --include-all-sources ./node_modules/.bin/_mocha -- tests/ --recursive
Result:
Expected result:
Am I expecting something wrong when testing this?
I am trying to test async functions. The tests work, but the function gets ignored in the code coverage.
Code:
Test:
Test command:
Result:
Expected result:
Am I expecting something wrong when testing this?