webdriverio-community / wdio-cucumberjs-json-reporter

A WDIO reporter that creates CucumberJS JSON files for WebdriverIO
https://webdriver.io/docs/wdio-cucumberjs-json-reporter
MIT License
22 stars 31 forks source link

CommonJS version of module only exports `attach` static method #232

Open jRichardeau opened 1 year ago

jRichardeau commented 1 year ago

Environment (please complete the following information):

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 commented 1 year ago

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!