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

delegate to Node on non-Mocha unhandled rejections #4489

Merged
merged 2 commits into from Nov 2, 2020

Commits on Oct 29, 2020

  1. delegate to Node on non-Mocha unhandled rejections

    This is not intended as a _fix_ for #4481, since it's possible that Mocha's behavior in v8.2.0 uncovers false positives.  In other cases--depending on the use-case--they are not false positives at all, but rather annoyances that depended on the pre-v15 behavior of Node.js to only issue warnings.
    
    This PR changes the behavior of Mocha so that it will re-emit unhandled rejections to `process` _if_ they did not generate from Mocha.  If the rejection generated from Mocha, then we treat it as an uncaught exception, because Mocha should not be in the business of ignoring its own unhandled rejections.  The logic for detecting an "error originating from Mocha" is not exhaustive.
    
    Once an unhandled rejection is re-emitted to `process`, Node decides what to do with it based on how it is configured to handle unhandled rejections (strict, warn, quiet, etc.).
    
    Added a public method to `errors` module; `isMochaError()`
    
    Ref: #4481
    boneskull committed Oct 29, 2020
    Copy the full SHA
    562b94a View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2020

  1. fix uncaught/strict test

    Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
    boneskull committed Oct 30, 2020
    Copy the full SHA
    fc0b6cd View commit details
    Browse the repository at this point in the history