-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: playwright coverage report showing incorrect results [WD-9070] #671
Conversation
Signed-off-by: Mason Hu <mason.hu@canonical.com>
Demo starting at https://lxd-ui-671.demos.haus |
@@ -23,7 +23,7 @@ const config: PlaywrightTestConfig<TestOptions> = { | |||
/* Retry on CI only */ | |||
retries: process.env.CI ? 2 : 0, | |||
/* Opt out of parallel tests on CI. */ | |||
workers: process.env.CI ? 1 : 3, | |||
workers: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the tests reuse the same resources, running those tests in parallel will fail sometimes
|
||
test.afterEach(async ({ page, hasCoverage }) => { | ||
await finishCoverage(page, hasCoverage); | ||
runCoverage: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I found the issue wasn't with nyc, turns out global beforeEach
and afterEach
hooks in playwright should be done this way instead of using test.beforeEach
and test.afterEach
. This was discovered after debugging where finishCoverage
didn't run for every test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for solving this!
|
||
test.afterEach(async ({ page, hasCoverage }) => { | ||
await finishCoverage(page, hasCoverage); | ||
runCoverage: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
Done
QA