-
Notifications
You must be signed in to change notification settings - Fork 79
Description
We may need to use a different sourceMapRegEx for inline code from the code reading through file path.
In Istanbul, if we instrument a file with option "embed-source:true", it will wrap the code with an immediate function. Like:
"(function() {
//original JS code....
/#sourceMappingURL=data:application/json;base64........
}());"
In this situation, the sourceMapRegEx cannot match the code, because it doesn't expect the code ending with some special characters like ')', and it couldn't resolve the sourceMap for this file.
I have tried to remove the $ from the sourceMapRegEx in CoverageTransformer.js line 66 and it can work.
var sourceMapRegEx = /(?:\/{2}[#@]{1,2}|\/\*)\s+sourceMappingURL\s*=\s*(data:(?:[^;]+;)+base64,)?(\S+)(?:\n\s*)?$/;
var sourceMapRegEx = /(?:\/{2}[#@]{1,2}|\/\*)\s+sourceMappingURL\s*=\s*(data:(?:[^;]+;)+base64,)?(\S+)(?:\n\s*)?/;
I'm not sure if we can simply use this change to fix, could you please help take a look?