Skip to content
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

feat(test-utils): Support coverage in BrowserTestDriver #246

Closed
wants to merge 2 commits into from

Conversation

Pessimistress
Copy link
Collaborator

No description provided.

@Pessimistress Pessimistress changed the title Support coverage in BrowserTestDriver feat(test-utils): Support coverage in BrowserTestDriver Feb 18, 2024
@@ -96,6 +98,10 @@ export default class BrowserDriver {
}
await Promise.all(promises);

if (coverage) {
await this.page.coverage.startJSCoverage();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments maybe? Are these methods part of puppeteer or installed by the dependency?

@@ -80,6 +83,15 @@ export default class BrowserTestDriver extends BrowserDriver {
}

const result = await this._openPage(url, config);

if (config.coverage) {
const coverageResult = await this.page?.coverage.stopJSCoverage();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It seems to me that this spreads out the coverage integration across base and subclass... For better encapsulation and symmetry, I feel that startJSCoverage and stopJSCoverage methods should both be called by either the BrowserDriver base class or this class.

@Pessimistress
Copy link
Collaborator Author

Closing this for now because puppeteer-to-istanbul does not report paths from the source directory, see istanbuljs/puppeteer-to-istanbul#61

We can revisit using puppeteer's native coverage feature at a later time.

@Pessimistress Pessimistress deleted the x/coverage branch March 8, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants