diff --git a/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts b/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts index 879cca9c..1dfb31eb 100644 --- a/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/core/coveragedisk.service.ts @@ -19,6 +19,7 @@ export class CoveragediskService { sha: string; reportID: string; coverage: any; + compareTarget: string; }) { return this.coveragediskRepository.insert({ pid: String(process.pid), diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts index 243edd12..2a0bf2cc 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-client.service.ts @@ -114,6 +114,7 @@ export class CoverageClientService { projectID, sha, reportID, + compareTarget: compareTarget || sha, coverage: hit, }); return { diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts index db2d1f1d..b49e6381 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts @@ -54,7 +54,7 @@ export class CoverageMapClientService { const resetCovMap = resetCoverageDataMap(formatCoverageMap); // #region == Step x: 覆盖率回溯,在覆盖率存储之前转换(这里一定要用数据库里的instrumentCwd,因为和map是对应的!!!) - const hitObject = await remapCoverageWithInstrumentCwd( + const hitObject: any = await remapCoverageWithInstrumentCwd( resetCovMap, instrumentCwd, ); diff --git a/packages/canyon-map/package.json b/packages/canyon-map/package.json index 633de2bf..e0933a26 100644 --- a/packages/canyon-map/package.json +++ b/packages/canyon-map/package.json @@ -1,6 +1,6 @@ { "name": "canyon-map", - "version": "2.0.0-beta.5", + "version": "2.0.0-beta.6", "description": "", "type": "module", "exports": { @@ -17,7 +17,7 @@ "dist" ], "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "vitest", "build": "rslib build", "prepublishOnly": "rslib build", "preinstall": "rslib build || true" @@ -28,10 +28,11 @@ "devDependencies": { "@rslib/core": "^0.1.5", "@types/istanbul-lib-coverage": "^2.0.6", - "@types/istanbul-lib-source-maps": "^4.0.4" + "@types/istanbul-lib-source-maps": "^4.0.4", + "vitest": "^2.1.8" }, "dependencies": { "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-source-maps": "^5.0.6" } -} \ No newline at end of file +} diff --git a/packages/canyon-map/src/coverage.ts b/packages/canyon-map/src/coverage.ts index 6b75a8eb..3cd163d0 100644 --- a/packages/canyon-map/src/coverage.ts +++ b/packages/canyon-map/src/coverage.ts @@ -42,8 +42,11 @@ export async function remapCoverageByOld(obj:any) { const obj2 = {}; // @ts-ignore aaa.forEach(item=>{ - // @ts-ignore - obj2[item.path] = item; + // 过滤作用 + if (item.path) { + // @ts-ignore + obj2[item.path] = item + } }); return obj2; } @@ -77,6 +80,7 @@ export const remapCoverageWithInstrumentCwd = async (noReMap:any, instrumentCwd: }; } + // console.log(JSON.stringify(obj2)); // 再把instrumentCwd去掉 return obj2; };