aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2021-09-12 14:27:10 -0400
committerKevin J Hoerr <kjhoerr@protonmail.com>2021-09-12 14:27:10 -0400
commitc3ce0680a9828d9bd3fc18f0c0f6ee87fa40868e (patch)
tree89c1191727a833cdc9b1733a23bd4c1f844ba3d9 /src
parent317b2590bf125ba3ceb1dba14d91d296f115846b (diff)
downloadao-coverage-c3ce0680a9828d9bd3fc18f0c0f6ee87fa40868e.tar.gz
ao-coverage-c3ce0680a9828d9bd3fc18f0c0f6ee87fa40868e.tar.bz2
ao-coverage-c3ce0680a9828d9bd3fc18f0c0f6ee87fa40868e.zip
Add target filename to format
Diffstat (limited to 'src')
-rw-r--r--src/formats.ts4
-rw-r--r--src/routes.ts2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/formats.ts b/src/formats.ts
index ab118ab..63d5f60 100644
--- a/src/formats.ts
+++ b/src/formats.ts
@@ -6,6 +6,7 @@ export interface Format {
// returns the coverage value as %: Number(90.0), Number(100.0), Number(89.5)
parseCoverage: (file: Document) => CoverageResult;
matchColor: (coverage: number, style: GradientStyle) => string;
+ fileName: string;
}
interface FormatList {
@@ -70,7 +71,8 @@ const FormatsObj: FormatObj = {
}
return (100 * covered) / coverable;
},
- matchColor: defaultColorMatches
+ matchColor: defaultColorMatches,
+ fileName: "index.html"
}
},
diff --git a/src/routes.ts b/src/routes.ts
index be4380a..31bce07 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -102,7 +102,7 @@ export default (metadata: Metadata): Router => {
// Write report and badge to directory
await fs.promises.writeFile(path.join(reportPath, "badge.svg"), badge);
await fs.promises.writeFile(
- path.join(reportPath, "index.html"),
+ path.join(reportPath, formatter.fileName),
contents
);