Repository navigation
Report not able to handle base64 files when using all: true #280
Description
Activity
@Toxicable interesting, if I'm understanding properly, this would be an artifact of running in a Bazel environment?
If we see a path in this format should we simply decode the base64 blob, rather than reading the file path? Any chance you could send a failing test?
Correct, something about how bazel + typescript is configured results in these paths.
Although this should be reproducable with just plain TS, since under the hood it's still just runningtsc
I'll reproduce it on the open source repository tonight and post here with a more a complete log output.Aight was able to reproduce it https://github.com/Toxicable/rules_nodejs/tree/path-issue , here's the full error:
(node:62) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'packages/jasmine/test/data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9uX2NvdmVyZWRfZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2phc21pbmUvdGVzdC9ub25fY292ZXJlZF9maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxTQUFTLFlBQVksQ0FBQyxLQUFhO0lBQy9CLE9BQU8sS0FBSyxHQUFHLENBQUMsQ0FBQztBQUNyQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZnVuY3Rpb24gc29tZUNvdmVyYWdlKGlucHV0OiBudW1iZXIpIHtcbiAgICByZXR1cm4gaW5wdXQgKyAzOyBcbn0iXX0' at Object.openSync (fs.js:440:3) at readFileSync (fs.js:342:35) at node_modules/c8/lib/report.js:175:78 at Array.forEach (<anonymous>) at Report._getMergedProcessCov (node_modules/c8/lib/report.js:167:41) at Report.getCoverageMapFromAllCoverageFiles (node_modules/c8/lib/report.js:66:31) at Report.run (node_modules/c8/lib/report.js:46:31) at internal/coverage/lcov_merger-js.js:68:14 at Generator.next (<anonymous>) at internal/coverage/lcov_merger-js.js:8:71 ```@Toxicable it looks like I can just decode the base64:
'{"version":3,"file":"non_covered_file.js","sourceRoot":"","sources":["../../../../../../packages/jasmine/test/non_covered_file.ts"],"names":[],"mappings":";AAAA,SAAS,YAAY,CAAC,KAAa;IAC/B,OAAO,KAAK,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["function someCoverage(input: number) {\\n return input + 3; \\n}"]}'That path looks pretty weird though no?
Yeah that's correct. That path is meant to look a bit weird :P
@Toxicable I'll make an effort to pick this up soon, would also happily take a patch. I was figuring that I'd detect file paths that look like this, and use the Base64 encoded value -- ignoring the start of the path.
Reports aren't able to read base64 source maps files
Looking at this line here: https://github.com/bcoe/c8/blob/master/lib/report.js#L189
It's not able to read files which have their content encoded as a base64 path.
Example:
path/to/file:application/json;base64,{base64 content}Right now it'll throw an error like: