-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: playwright coverage report showing incorrect results
Signed-off-by: Mason Hu <[email protected]>
- Loading branch information
Showing
3 changed files
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import { test as base } from "@playwright/test"; | ||
import { Page, test as base } from "@playwright/test"; | ||
import { finishCoverage, startCoverage } from "./coverage"; | ||
|
||
export type LxdVersions = "5.0-stable" | "latest-edge"; | ||
export type TestOptions = { | ||
lxdVersion: LxdVersions; | ||
hasCoverage: boolean; | ||
runCoverage: Page; | ||
}; | ||
|
||
export const test = base.extend<TestOptions>({ | ||
lxdVersion: ["latest-edge", { option: true }], | ||
hasCoverage: [false, { option: true }], | ||
}); | ||
|
||
test.beforeEach(async ({ page, hasCoverage }) => { | ||
await startCoverage(page, hasCoverage); | ||
}); | ||
|
||
test.afterEach(async ({ page, hasCoverage }) => { | ||
await finishCoverage(page, hasCoverage); | ||
runCoverage: [ | ||
async ({ page, hasCoverage }, use) => { | ||
await startCoverage(page, hasCoverage); | ||
await use(page); | ||
await finishCoverage(page, hasCoverage); | ||
}, | ||
{ auto: true }, | ||
], | ||
}); | ||
|
||
export const expect = test.expect; |