Conversation
DABH
commented
Jan 3, 2024
| * `unhandleRejections`. | ||
| * @type {Object} | ||
| */ | ||
| Object.defineProperty(exports, 'rejections', { |
Contributor
Author
There was a problem hiding this comment.
This doesn't get used anywhere atm but for completeness it felt like we should have this to parallel exceptions right above?
Contributor
Author
|
Scarily the tests passed locally even without a3e7ce8 ^^ 😬 |
DABH
commented
Jan 3, 2024
| }); | ||
|
|
||
| it('.handle()', function (done) { | ||
| process.removeAllListeners('unhandledRejection'); |
Contributor
Author
There was a problem hiding this comment.
This is the line in question. If possible, it's probably best to make a copy of mocha's listener, then remove all, then run the test, then remove all again at the end of the test (i.e., ensure the one we add during the test is removed) and finally re-add mocha's.
Vylpes
pushed a commit
to Vylpes/card-drop
that referenced
this pull request
Apr 23, 2024
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [winston](https://github.com/winstonjs/winston) | dependencies | minor | [`3.11.0` -> `3.13.0`](https://renovatebot.com/diffs/npm/winston/3.11.0/3.13.0) | --- ### Release Notes <details> <summary>winstonjs/winston (winston)</summary> ### [`v3.13.0`](https://github.com/winstonjs/winston/releases/tag/v3.13.0) [Compare Source](winstonjs/winston@v3.12.1...v3.13.0) - fix(http): allow passing maximumDepth to prevent big object being stringified ([#​2425](winstonjs/winston#2425)) [`a237865`](winstonjs/winston@a237865) ### [`v3.12.1`](https://github.com/winstonjs/winston/releases/tag/v3.12.1) [Compare Source](winstonjs/winston@v3.12.0...v3.12.1) - Bump [@​types/node](https://github.com/types/node) from 20.11.24 to 20.11.29 ([#​2431](winstonjs/winston#2431)) [`b10b98f`](winstonjs/winston@b10b98f) - Revert "Remove nonexistent Logger methods from types" ([#​2434](winstonjs/winston#2434)) [`0277035`](winstonjs/winston@0277035) - fixed flaky test case ([#​2412](winstonjs/winston#2412)) [`d95c948`](winstonjs/winston@d95c948) ### [`v3.12.0`](https://github.com/winstonjs/winston/releases/tag/v3.12.0) [Compare Source](winstonjs/winston@v3.11.0...v3.12.0) - missing timestamp format in ready-to-use-pattern example ([#​2421](winstonjs/winston#2421)) [`9e5b407`](winstonjs/winston@9e5b407) - bump deps ([#​2422](winstonjs/winston#2422)) [`4a85e6b`](winstonjs/winston@4a85e6b) - \[chore] Run coveralls CI check on Node 20 not 16 ([#​2418](winstonjs/winston#2418)) [`e153c68`](winstonjs/winston@e153c68) - Bump [@​types/node](https://github.com/types/node) from 20.8.6 to 20.11.19 ([#​2413](winstonjs/winston#2413)) [`587f40f`](winstonjs/winston@587f40f) - Update README.md ([#​2417](winstonjs/winston#2417)) [`8e99a00`](winstonjs/winston@8e99a00) - docs: fix anchor in transports docs ([#​2416](winstonjs/winston#2416)) [`0bde36b`](winstonjs/winston@0bde36b) - add winston-transport-vscode to transports docs ([#​2411](winstonjs/winston#2411)) [`8fb5b41`](winstonjs/winston@8fb5b41) - Bump [@​babel/cli](https://github.com/babel/cli) from 7.23.0 to 7.23.9 ([#​2406](winstonjs/winston#2406)) [`a326743`](winstonjs/winston@a326743) - Add winston-newrelic-agent-transport to transport documentation ([#​2382](winstonjs/winston#2382)) [`cc731ef`](winstonjs/winston@cc731ef) - Remove newrelic-winston transport entry. ([#​2405](winstonjs/winston#2405)) [`f077f30`](winstonjs/winston@f077f30) - Bump eslint from 8.55.0 to 8.56.0 ([#​2397](winstonjs/winston#2397)) [`3943c41`](winstonjs/winston@3943c41) - Bump the npm_and_yarn group group with 1 update ([#​2391](winstonjs/winston#2391)) [`8260866`](winstonjs/winston@8260866) - Fix unhandled rejection handling ([#​2390](winstonjs/winston#2390)) [`333b763`](winstonjs/winston@333b763) - Fix all rimraf usages to the best of my ability; glob is not true by default in rimraf; file archive test only passed every other time using async rimraf, could use further investigation [`c3f3b5b`](winstonjs/winston@c3f3b5b) - Fix rimraf usage in new test [`8f3c653`](winstonjs/winston@8f3c653) - Fix rimraf import in test (why didn't this break in PR CI?) [`f3836aa`](winstonjs/winston@f3836aa) - Added functionality to long broken zippedArchive option ([#​2337](winstonjs/winston#2337)) [`02d4267`](winstonjs/winston@02d4267) - Bump async from 3.2.4 to 3.2.5 ([#​2378](winstonjs/winston#2378)) [`069a40d`](winstonjs/winston@069a40d) - Bump [@​babel/preset-env](https://github.com/babel/preset-env) from 7.23.2 to 7.23.7 ([#​2384](winstonjs/winston#2384)) [`79282e1`](winstonjs/winston@79282e1) - Bump winston-transport; fix test issue ([#​2386](winstonjs/winston#2386)) [`05788b9`](winstonjs/winston@05788b9) - Bump eslint from 8.51.0 to 8.55.0 ([#​2375](winstonjs/winston#2375)) [`a7c2eec`](winstonjs/winston@a7c2eec) - Bump std-mocks from 1.0.1 to 2.0.0 ([#​2361](winstonjs/winston#2361)) [`85c336e`](winstonjs/winston@85c336e) - Bump actions/setup-node from 3 to 4 ([#​2362](winstonjs/winston#2362)) [`448d11c`](winstonjs/winston@448d11c) - chore(README.md): adds documentation around coloring json formatted logs [`91ec069`](winstonjs/winston@91ec069) - Remove nonexistent Logger methods from types [`c3c3911`](winstonjs/winston@c3c3911) - Update dependencies [`caf2df6`](winstonjs/winston@caf2df6) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=--> Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/212 Reviewed-by: Vylpes <ethan@vylpes.com> Co-authored-by: Renovate Bot <renovate@vylpes.com> Co-committed-by: Renovate Bot <renovate@vylpes.com>
This was referenced May 19, 2024
This was referenced Oct 1, 2024
This was referenced Nov 1, 2024
ab-pm
reviewed
Nov 26, 2025
| ].join('\n'), | ||
| stack: err && err.stack, | ||
| exception: true, | ||
| rejection: true, |
There was a problem hiding this comment.
This should have been advertised as a breaking change in the changelog / release notes. (Or for backwards compatibility, used both properties).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Winston 3 supports catching/handling unhandled promise rejections. However, it looks like the implementation had some issues (which are probably my fault). Here is the story, for posterity:
We first noticed that we couldn't upgrade
mochapast 8.1.3 (even to 8.2.0) without making our basic rejection handler test fail. I found that between these two versions (mochajs/mocha@v8.1.3...v8.2.0), some code involving listeners was added, and the effect seems to be that mocha adds an unhandled rejection listener to the process, which wasn't present in prior versions (they don't seem to add one for exceptions, don't ask). So we ensured we were removing the handler mocha added (TODO: it's probably best if we add it back after our test is done, though seems to be harmless to not have it).However, we then saw that we couldn't make the test fail by messing around with the asserts. In other words, it seemed like the unhandled rejections weren't really getting handled by our handler. This led to some step-by-step debugging through the winston callchain to see where these rejections were going.
Eventually we realized that rejection objects (via the
getAllInfowrapper) were being treated like exceptions -- we used anExceptionStreamwrapper that filtered for, essentially, exceptions rather than rejections. We added aRejectionStreamwrapper class and made necessary changes, and then everything was finally flowing smoothly.In summary, the handler test for rejection handlers in winston basically wasn't checking anything (or at least not the intended thing) before, and we're not sure how broken rejection handling really was given this finding.
Oh, and we can now use the latest mocha version...