webdriverio-community/wdio-cucumberjs-json-reporter

TypeError: Cannot convert undefined or null to object

joao-motork opened this issue · 5 comments

Environment (please complete the following information):

  • Node.js version: 16.20.0
  • NPM version: 8.19.4
  • webdriver.io version: 8.10.0
  • @wdio/cucumber-framework version: 8.10.0
  • wdio-cucumberjs-json-reporter version: 5.1.2

Config of webdriver.io and the reporter
config.zip

Describe the bug
When I run an automation test suite filtering the scenarios to run using a tag, like the following example:
image

Per each feature file that does not have any scenario to run (because does not have the intended tag), it is being logged the following error:

[0-16] 2023-05-08T11:53:52.777Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot convert undefined or null to object [0-16] at hasOwnProperty (<anonymous>) [0-16] at Metadata.determineMetadata (file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/wdio-cucumberjs-json-reporter/src/metadata.ts:16:73) [0-16] at CucumberJsJsonReporter.onRunnerStart (file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/wdio-cucumberjs-json-reporter/src/index.ts:95:62) [0-16] at CucumberJsJsonReporter.<anonymous> (file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/@wdio/reporter/build/index.js:59:18) [0-16] at CucumberJsJsonReporter.emit (node:events:513:28) [0-16] at CucumberJsJsonReporter.emit (node:domain:489:12) [0-16] at file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/@wdio/runner/build/reporter.js:47:56 [0-16] at Array.forEach (<anonymous>) [0-16] at BaseReporter.emit (file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/@wdio/runner/build/reporter.js:47:25) [0-16] at Runner._shutdown (file:///C:/Repos/QA/e2e-dealerk-dashboard-admin/node_modules/@wdio/runner/build/index.js:316:28)

image

Thanks for reporting!

Any contributions that resolves the bug are highly appreciated. Don't expect this to be picked up by active contributors as they have their own priorities. If you depend on this bug to be fixed, your contribution is required. Please take a look into our contribution guidelines or join our Discord development server and let us know if you have any questions. Cheers!

Hi @christian-bromann

I updated wdio-cucumberjs-json-reporter package to version: 5.1.3, now there is this error:

image

[0-0] file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/wdio-cucumberjs-json-reporter/src/index.ts:217 [0-0] ? ${this.report.feature.id}_${uniqueId}.json [0-0] ^ [0-0] TypeError: Cannot read properties of undefined (reading 'id') [0-0] at CucumberJsJsonReporter.onRunnerEnd (file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/wdio-cucumberjs-json-reporter/src/index.ts:217:38) [0-0] at CucumberJsJsonReporter.<anonymous> (file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/@wdio/reporter/build/index.js:173:22) [0-0] at CucumberJsJsonReporter.emit (node:events:513:28) [0-0] at CucumberJsJsonReporter.emit (node:domain:489:12) [0-0] at file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/@wdio/runner/build/reporter.js:47:56 [0-0] at Array.forEach (<anonymous>) [0-0] at BaseReporter.emit (file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/@wdio/runner/build/reporter.js:47:25) [0-0] at Runner._shutdown (file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/@wdio/runner/build/index.js:326:24) [0-0] at Runner.run (file:///C:/Repos/QA/e2e-ui-boilerplate-webdriverio/node_modules/@wdio/runner/build/index.js:75:25) [0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5) { [0-0] [Symbol(originalCallSite)]: [ [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {} [0-0] ], [0-0] [Symbol(mutatedCallSite)]: [ [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {}, [0-0] CallSite {}, CallSite {} [0-0] ] [0-0] }

@joao-motork bummer, do you think you can raise a PR for that?

@christian-bromann
#144
Could you check it?