cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.04k stars 1.09k forks source link

summary_helpers throw TypeError #2298

Closed karol719 closed 1 year ago

karol719 commented 1 year ago

👓 What did you see?

I am using CircleCI and Cucumber, my workflow contains setup step and then steps with cucumber tests, after successful tests there is type error which looks like this:

/home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77
  objects.forEach((x) => (counts[x.status] += 1))
          ^
TypeError: Cannot read properties of undefined (reading 'status')
    at /home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77:36
    at Array.forEach (<anonymous>)
    at getCountSummary (/home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:77:11)
    at formatSummary (/home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/helpers/summary_helpers.ts:53:23)
    at ProgressFormatter.logSummary (/home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/summary_formatter.ts:72:20)
    at EventEmitter.<anonymous> (/home/circleci/project/node_modules/@cucumber/cucumber/src/formatter/summary_formatter.ts:27:14)
    at EventEmitter.emit (node:events:402:35)
    at EventEmitter.emit (node:domain:475:12)
    at Coordinator.onWorkerProcessClose (/home/circleci/project/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:200:29)
    at ChildProcess.<anonymous> (/home/circleci/project/node_modules/@cucumber/cucumber/src/runtime/parallel/coordinator.ts:158:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

✅ What did you expect to see?

success message

📦 Which tool/library version are you using?

I'm using

"@cucumber/cucumber": "^9.0.1",
"cucumber-tsflow": "^4.0.0-rc.7",

🔬 How could we reproduce it?

Circle Ci setup tests so it runs npm install, and then it should run in parallel 4 jobs which performs tests from 4 different cucumber configurations.

davidjgoss commented 1 year ago

The error is because there should be a result for a step and it's not there. We could make the code more defensive but I'd like to understand how this can happen. Are you able to post a minimum reproducible example repo that this happens with? Can you reproduce locally? Can you switch to use the message formatter and post that output somewhere?

karol719 commented 1 year ago

There was issue with config we had something like this

module.exports = {
  default: {
    paths: ['test/e2e/feature/x/**/*.feature'],
    require: [
      'test/e2e/step-definitions/x/**/*.ts',
      'test/e2e/step-definitions/http.step-definition.ts',
    ],
    requireModule: ['ts-node/register'],
    publishQuiet: true,
    parallel: 1,
  },
};

When parallel is set to 1 then there was an issue, but if I removed parallel everything works fine.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 3 weeks with no activity. Remove the stale label or comment or this will be closed in another 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.