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

CommonJS version of module only exports attach static method #232

Open
jRichardeau opened this issue Jul 24, 2023 · 1 comment
Open

CommonJS version of module only exports attach static method #232

jRichardeau opened this issue Jul 24, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@jRichardeau
Copy link

Environment (please complete the following information):

  • Node.js version: 18.16
  • NPM version: 9.5.1
  • webdriver.io version: 8.11.2
  • @wdio/cucumber-framework version: 8.11.0
  • wdio-cucumberjs-json-reporter version: 5.1.6

Config of webdriver.io and the reporter
I'm trying to create a custom reporter that extends wdio-cucumberjs-json-reporter to overload some behaviors.

import * as CucumberJsJsonReporter from 'wdio-cucumberjs-json-reporter';

export default class CustomReporter extends CucumberJsJsonReporter {
...
}

Describe the bug
The problem occurs when trying to import CucumberJsJson from a file imported as a commonJS module because as you can see in this file of wdio-cucumberjs-json-reporter, the commonJS version of the module only exports the attach static method.

The created reporter is so invalid and does not contain methods like emit or others that should be inherited from WDIO as in the "non commonJS" version.

To Reproduce
Import wdio-cucumberjs-json-reporter from a commonJS module, you will see that only attach method is available.

Expected behavior
Both "non commonJS" and commonJS versions of this module should export the same api.

Thank you

@christian-bromann
Copy link
Contributor

Thanks for reporting!

Even though we encourage folks to use ESM (at least for their testing) I understand that this is sometimes not feasible. Therefore if you can provide a PR that compiles two versions of this reporter (one ESM and the other CJS) we are happy to merge and release that.

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

@christian-bromann christian-bromann added the help wanted Extra attention is needed label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants