diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2021-09-12 15:36:49 -0400 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2021-09-12 15:36:49 -0400 |
| commit | 77575aab559f058d886a691eefe262cf0f306710 (patch) | |
| tree | 04a42450b1434905d10840525eacf5c05a18586f /src/formats.test.ts | |
| parent | c3ce0680a9828d9bd3fc18f0c0f6ee87fa40868e (diff) | |
| download | ao-coverage-77575aab559f058d886a691eefe262cf0f306710.tar.gz ao-coverage-77575aab559f058d886a691eefe262cf0f306710.tar.bz2 ao-coverage-77575aab559f058d886a691eefe262cf0f306710.zip | |
Refactor coverage upload for ease of new formats
Diffstat (limited to 'src/formats.test.ts')
| -rw-r--r-- | src/formats.test.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/formats.test.ts b/src/formats.test.ts index eb38ab1..1536b5d 100644 --- a/src/formats.test.ts +++ b/src/formats.test.ts @@ -1,7 +1,6 @@ import Formats, { defaultColorMatches } from "./formats"; import fs from "fs"; import path from "path"; -import { JSDOM } from "jsdom"; describe("Color matcher", () => { it.each` @@ -109,12 +108,11 @@ describe("Tarpaulin format", () => { it("should parse coverage from a normal tarpaulin file", () => { // Arrange const file = fs.readFileSync(reportPath("tarpaulin-report.html"), "utf-8"); - const document = new JSDOM(file).window.document; const format = Formats.getFormat("tarpaulin"); // Act - const result = format.parseCoverage(document); + const result = format.parseCoverage(file); // Assert expect(typeof result).toEqual("number"); @@ -127,12 +125,11 @@ describe("Tarpaulin format", () => { it("should parse coverage from an empty tarpaulin file", () => { // Arrange const file = fs.readFileSync(reportPath("tarpaulin-empty.html"), "utf-8"); - const document = new JSDOM(file).window.document; const format = Formats.getFormat("tarpaulin"); // Act - const result = format.parseCoverage(document); + const result = format.parseCoverage(file); // Assert expect(typeof result).toEqual("number"); @@ -144,12 +141,11 @@ describe("Tarpaulin format", () => { it("should return error when parsing coverage from invalid file", () => { // Arrange const file = fs.readFileSync(reportPath("tarpaulin-invalid.html"), "utf-8"); - const document = new JSDOM(file).window.document; const format = Formats.getFormat("tarpaulin"); // Act - const result = format.parseCoverage(document); + const result = format.parseCoverage(file); // Assert expect(typeof result).not.toEqual("number"); |
