douglasduteil / isparta

:skull: A code coverage tool for ES6 (babel/6to5)
Do What The F*ck You Want To Public License
642 stars 47 forks source link

Async functions get ignored for code coverage #108

Closed queicherius closed 7 years ago

queicherius commented 8 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:

screen shot 2016-01-30 at 21 00 37

Expected result:

Am I expecting something wrong when testing this?