From 283ac5f5fec6007cac5140d22fa20cdb3a8a2bb8 Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Tue, 12 Nov 2024 15:58:55 +0800 Subject: [PATCH] chore: repo overall update --- .../collect/services/coverage-client.service.ts | 4 ++-- packages/canyon-backend/src/utils/coverage.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/canyon-backend/src/apps/collect/services/coverage-client.service.ts b/packages/canyon-backend/src/apps/collect/services/coverage-client.service.ts index 9af273ff..957cae5f 100755 --- a/packages/canyon-backend/src/apps/collect/services/coverage-client.service.ts +++ b/packages/canyon-backend/src/apps/collect/services/coverage-client.service.ts @@ -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 { @@ -34,7 +34,7 @@ export class CoverageClientService { const {coverage} =await formatReportObject({ - coverage: resetCoverageData(oldcoverage), + coverage: resetCoverageData(regularData(oldcoverage)), instrumentCwd: invoke.instrumentCwd, }) diff --git a/packages/canyon-backend/src/utils/coverage.ts b/packages/canyon-backend/src/utils/coverage.ts index 115800d8..67bdcddb 100644 --- a/packages/canyon-backend/src/utils/coverage.ts +++ b/packages/canyon-backend/src/utils/coverage.ts @@ -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; +}