You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the way the chai assertion library traps exceptions that are thrown causes c8 not to mark the executed lines as covered. I don't know if the issue is caused by c8 or by chai, though.
Steps to reproduce
Consider the following source file (index.mjs):
functionf(x){if(x==0){throw"foo";}}export{f};
And the following chai test case (test/test.test.js):
...this time all lines in index.mjs are marked as covered.
The text was updated successfully, but these errors were encountered:
sylvainhalle
changed the title
Line with throw not marked as covered if caught by mocha assertion
Line with throw not marked as covered if caught by chai assertion
Jan 27, 2021
It seems that the way the chai assertion library traps exceptions that are thrown causes c8 not to mark the executed lines as covered. I don't know if the issue is caused by c8 or by chai, though.
Steps to reproduce
Consider the following source file (
index.mjs
):And the following chai test case (
test/test.test.js
):Expected outcome
index.mjs
is marked as coveredObserved outcome
Additional note
If I replace the test case with this alternate version:
...this time all lines in
index.mjs
are marked as covered.The text was updated successfully, but these errors were encountered: