sonar / sonar (push) Skipped
sonar / sonar (pull_request) Canceled after 7m29s
Co-authored-by: Cursor <cursoragent@cursor.com>
11 lines
395 B
JavaScript
11 lines
395 B
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
|
|
const file = path.join("coverage", "lcov.info");
|
|
const remapped = fs.readFileSync(file, "utf8").replace(/^SF:(.+)$/gm, (_, p) => {
|
|
const norm = String(p).replaceAll("\\", "/");
|
|
const match = /(?:^|\/)dist\/(.+)\.js$/.exec(norm);
|
|
return match ? `SF:src/${match[1]}.ts` : `SF:${norm}`;
|
|
});
|
|
fs.writeFileSync(file, remapped);
|