Skip to content

Allow extending handleTestEvent in PlaywrightEnvironment #821

Open
@juan-fernandez

Description

@juan-fernandez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions