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

🐛 Bug: Setting readOnly properties in breakCircularDeps breaks the reporter in parallel mode with allow-uncaught #5188

Open
3 of 4 tasks
satyen95 opened this issue Aug 6, 2024 · 4 comments
Labels
status: in triage a maintainer should (re-)triage (review) this issue type: bug a defect, confirmed by a maintainer

Comments

@satyen95
Copy link

satyen95 commented Aug 6, 2024

Bug Report Checklist

  • I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
  • I have searched for related issues and issues with the faq label, but none matched my issue.
  • I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
  • I want to provide a PR to resolve this

Expected

Tests should run perfectly even if a it block (test) is failing
Error in it block (test) should not break parallel-buffered-runner.js even if --allow-uncaught is passed

Actual

All the tests get executed in the expected behaviour, but before the EVENT_RUN_END the process fails while serializing the results with the below error:

/XXX/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js:357
          throw err;
          
TypeError: Cannot set property maxHeaderSize of #<Object> which has only a getter
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:16)
    at _breakCircularDeps (/XXXnode_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)
    at _breakCircularDeps (/XXX/node_modules/mocha/lib/utils.js:679:18)

Failure point:
Screenshot 2024-08-06 at 3 43 31 PM
Reason: Trying to set a read-only property, which only has a getter

Minimal, Reproducible Example

Config:

  • allow-uncaught: true
  • parallel: true

Library dependency (easy to reproduce):
axios: 1.6.8

Create a suite, create a test in it, and make an incorrect/failing API call

Run the tests it will break

Versions

Mocha version: 10.7.0
Node: v20.15.1
OS: MacOS Sonoma 14.2.1 (23C71)

Additional Info

No response

@satyen95 satyen95 added status: in triage a maintainer should (re-)triage (review) this issue type: bug a defect, confirmed by a maintainer labels Aug 6, 2024
@voxpelli
Copy link
Member

voxpelli commented Aug 6, 2024

This is a regression caused by #5032

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Aug 6, 2024

Could someone (@satyen95?) please post a full reproduction we can work with locally?

We might have just fixed this with #5173 (to be released in a patch version soon). But it's hard to be sure we're doing the same steps as you without an actual reproduction.

https://antfu.me/posts/why-reproductions-are-required#why-reproduction

@satyen95
Copy link
Author

satyen95 commented Aug 7, 2024

@JoshuaKGoldberg You can reproduce the issue via this zip, I have added the code for it

mocha-5188.zip

@satyen95
Copy link
Author

satyen95 commented Aug 7, 2024

@JoshuaKGoldberg
Also, I have a question what is the exact behaviour of allow-uncaught will it stop due expect failures too (inside it block)?

Because the behaviour of it is correct in my main project, Run only fails/breaks when the worker processes close due to failure at setup time & not due to any failures in it block. That's the only reason why I have used allow-uncaught.

But the behaviour is different in the given example, run is stopped even due to failure in it block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in triage a maintainer should (re-)triage (review) this issue type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants