microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
55e232d553efb50cdb0f2db3fea905f63cc9248a

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

eng/scripts/merge-coverage.js

39lines · modecode

1// @ts-check
2import { copyFileSync, existsSync, mkdirSync, readdirSync } from "fs";
3import { join } from "path";
4import { runOrExit } from "../../packages/internal-build-utils/dist/src/index.js";
5import { forEachProject, repoRoot } from "./helpers.js";
6
7// Create folder to collect all coverage files
8const rootCoverageTmp = join(repoRoot, "coverage", "tmp");
9mkdirSync(rootCoverageTmp, { recursive: true });
10
11// Copy coverage files from each project to common folder
12forEachProject((name, location, project) => {
13 const coverageTmp = join(location, "coverage", ".tmp");
14 if (existsSync(coverageTmp)) {
15 const files = readdirSync(coverageTmp);
16 for (const file of files) {
17 copyFileSync(join(coverageTmp, file), join(rootCoverageTmp, file));
18 }
19 }
20});
21
22// Generate merged report
23await runOrExit(
24 "npm",
25 [
26 "exec",
27 "--no",
28 "--prefix",
29 "packages/compiler",
30 "c8",
31 "--",
32 "report",
33 "--reporter=cobertura",
34 "--reporter=text",
35 ],
36 {
37 cwd: repoRoot,
38 }
39);
40