Closed just-paja closed 7 years ago
This is likely due to the source map generated by babel. Could you post a screenshot of the code generated by babel for that file?
@jmcriffey, I added babel output to the example repo.
This line is definitely the culprit. What usually happens in these cases are a feature gets added and the source map gets broken in some small way. If the source map doesn't reflect the code correctly, then this tool cannot do its job. With that being said, there are three possible solutions:
Use the babel-runtime
transform in your babel config. Using this transform will use babel helper function calls instead of injecting all of that logic in every file. I think this is the best solution, as it also optimizes your file size.
Look at babel and figure out how to fix the sourcemap for toConsumableArray
. Then open a PR for the fix in their repo.
Try different versions (older and newer) of babel and its presets. This could be a sourcemap issue with the newest versions, or it could be and old issue that is already fixed in a more current version.
@jmcriffey, thank you for explanation. I think that this could become part of the projects README.
I tried the proposed solution number 1 and it worked. Thanks. I'll keep the example repository archived for other people to see the problem and the solution.
There seems to be some problem when covering code with combination of
import
,spread operator
andmultiline comments
. Istanbul will report else branch uncovered on the leading multiline comment.I prepared example repository where the problem is reproducable and also contains examples that are working.