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 29, 2024
1 parent e96a045 commit 7702b01
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { coverageObj } from "../models/coverage.model";
import {
formatCoverageData,
remapCoverageWithInstrumentCwd,
resetCoverageDataMap,
} from "canyon-data2";
import {
genSummaryMapByCoverageMap,
getSummaryByPath,
} from "../../../canyon-data/src";
import { reorganizeCompleteCoverageObjects } from "canyon-data2/src";
import { mergeCoverageMap } from "canyon-data";
// import { resetCoverageDataMap } from "canyon-data2/src";

@Injectable()
export class CoverageMapClientService {
Expand Down Expand Up @@ -47,12 +51,14 @@ export class CoverageMapClientService {
}
async updateMap({ exist, newMap }) {
const oldMap = await decompressedData(exist.map);
const oldHit = await decompressedData(exist.hit);
const { hit, map, summary, statementsTotal } = await this.generateData({
newMap: {
...oldMap,
...newMap,
},
instrumentCwd: exist.instrumentCwd,
oldHit,
});

return this.prisma.coverage
Expand All @@ -79,6 +85,7 @@ export class CoverageMapClientService {
const { hit, map, summary, statementsTotal } = await this.generateData({
newMap,
instrumentCwd,
oldHit: {},
});
return this.prisma.coverage
.create({
Expand Down Expand Up @@ -124,10 +131,18 @@ export class CoverageMapClientService {
}

// newMap是未经过reMap的数据,并且没有fbs
async generateData({ newMap, instrumentCwd }) {
const hit = await remapCoverageWithInstrumentCwd(newMap, instrumentCwd);
const hitBuffer = await compressedData(hit);
const summary = genSummaryMapByCoverageMap(hit, []);
async generateData({ newMap, instrumentCwd, oldHit }) {
const newHit = await remapCoverageWithInstrumentCwd(
resetCoverageDataMap(newMap),
instrumentCwd,
);

// const newHit = resetCoverageDataMap(reMapMap);

const mergedHit = mergeCoverageMap(oldHit, newHit);

const hitBuffer = await compressedData(mergedHit);
const summary = genSummaryMapByCoverageMap(mergedHit, []);
const overallSummary: any = getSummaryByPath("", summary);
const summaryBuffer = await compressedData(summary);
const mapBuffer = await compressedData(newMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Page() {

const onSelect = (val: any) => {
// TODO 防止页面刷新,但是不能回退,是否有更好的方式?
history.pushState(null, "", `/projects/${id}/commits/${sha}/${val}`);
history.pushState(null, "", `/projects/gl/${id}/auto/commits/${sha}/${val}`);
// 设置当前选择的路径
setValue(val);
// 处理选择事件
Expand Down

0 comments on commit 7702b01

Please sign in to comment.