Skip to content

Commit

Permalink
chore: repo overall update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangtao25 committed Nov 12, 2024
1 parent fc86374 commit 283ac5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import {PrismaService} from "../../../prisma/prisma.service";
import {IstanbulHitMapSchema} from "../../../zod/istanbul.zod";
import {compressedData} from "../../../utils/zstd";
import {formatReportObject, resetCoverageData} from "../../../utils/coverage";
import {formatReportObject, regularData, resetCoverageData} from "../../../utils/coverage";

@Injectable()
export class CoverageClientService {
Expand Down Expand Up @@ -34,7 +34,7 @@ export class CoverageClientService {


const {coverage} =await formatReportObject({
coverage: resetCoverageData(oldcoverage),
coverage: resetCoverageData(regularData(oldcoverage)),
instrumentCwd: invoke.instrumentCwd,
})

Expand Down
14 changes: 14 additions & 0 deletions packages/canyon-backend/src/utils/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,17 @@ export function resetCoverageData(coverageData) {
return acc;
}, {});
}


export function regularData(data: any) {
const obj = {};
const coverage = data;
// 针对windows电脑,把反斜杠替换成正斜杠
// 做数据过滤,去除 \u0000 字符
for (const coverageKey in coverage) {
if (!coverageKey.includes("\u0000")) {
obj[coverageKey] = coverage[coverageKey];
}
}
return obj;
}

0 comments on commit 283ac5f

Please sign in to comment.