jeffrifwald / babel-istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
144 stars 23 forks source link

return expression of async function is not showing coverage #16

Closed tikotzky closed 9 years ago

tikotzky commented 9 years ago

if you test the following code...

async function foo(){
    return 'foo';
}

(async () => {
    let result = await foo();
    console.log(result);
})();

the coverage comes out looking like index js 2015-06-21 21-15-34

Swatinem commented 9 years ago

It works for me now after #15. However, the console.log after the await is not called for me (I don’t see the log when i run it with babel-istanbul cover)

jeffrifwald commented 9 years ago

@Swatinem What are you using to actually run the tests? You might be exiting before the log statement is hit.

Swatinem commented 9 years ago

just babel-istanbul cover --babel-stage 1 --use-babel-runtime test.js with the code pasted in. So yes, I do think that it exits before the log (or even before returning from the await)

tikotzky commented 9 years ago

@Swatinem do you get the log in your console?

tikotzky commented 9 years ago

just ran it again and it looks good now.

index js 2015-06-22 14-51-26