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

Allow extending handleTestEvent in PlaywrightEnvironment #821

Open
juan-fernandez opened this issue Sep 19, 2024 · 1 comment · May be fixed by #822
Open

Allow extending handleTestEvent in PlaywrightEnvironment #821

juan-fernandez opened this issue Sep 19, 2024 · 1 comment · May be fixed by #822

Comments

@juan-fernandez
Copy link

Is your feature request related to a problem? Please describe.
This is specifically a problem for libraries intercepting jest-environment-* libraries to create integrations.

In this specific line:

    async handleTestEvent(event: Event) {
      const { browserName } = this._config
      const { collectCoverage, haveSkippedTests } = this._jestPlaywrightConfig
      const browserType = getBrowserType(browserName)
      //...

we're not calling super.handleTestEvent which would help said libraries.

Describe the solution you'd like
Change to above to

    async handleTestEvent(event: Event) {
      // calling `super.handleTestEvent` in case it's there
      if (super.handleTestEvent) {
        await super.handleTestEvent.apply(this, arguments)
      }
      const { browserName } = this._config
      const { collectCoverage, haveSkippedTests } = this._jestPlaywrightConfig
      const browserType = getBrowserType(browserName)
      //...

This would help:

  • in case jest-environment-* libraries decide to implement their own handleTestEvent
  • with Datadog's test visibility library, making it easier to integrate both libraries

Describe alternatives you've considered
Calling super.handleTestEvent seems low risk, so no alternatives were considered.

@juan-fernandez juan-fernandez linked a pull request Sep 19, 2024 that will close this issue
@juan-fernandez
Copy link
Author

PR in #822

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 a pull request may close this issue.

1 participant