swc-plugin-coverage-instrument
swc-plugin-coverage-instrument copied to clipboard
Incomplete instrumentation for nested functions
Hi, First of all, thanks for your plugin, it help us greatly in our tooling process in order to pass our quality gate ❤️
We have found a very tricky issue when defining nested function / callback and chaining with boolean operator.
For example:
data?.map((stat) => {
console.log(stat); <-- no instrumentation :'(
return "bla"; <-- no instrumentation :'(
}) || [];
(data || []).map((stat) => {
console.log(stat); <-- instrumentation!
return "bla"; <-- instrumentation!
});
Doing the instrumentation with NYC, i have no issue, everything is covered.
Repo for reproducing the issue on a minimal scope: https://github.com/astik/swc-plugin-coverage-instrument-issue-224.
Probably there are some uncovered paths in the visitor. I may not have time to look into this, but happy to accept a PR with corresponding test case.
Would have love to help this project, but i've got no knowledge about Rust :'(
I think this is adquetely resolved with latest release.