Repository navigation
Conversation
Emit DEP0212 when async_hooks.createHook() is called, as the first step before putting it behind a flag. The inspector and the node.async_hooks trace event category use an internal createHook() and do not emit the warning. Refs: nodejs#61030 Signed-off-by: Matteo Collina <hello@matteocollina.com>
|
Review requested:
|
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67271 +/- ##
==========================================
- Coverage 92.99% 90.68% -2.32%
==========================================
Files 428 797 +369
Lines 195754 279675 +83921
Branches 30292 53790 +23498
==========================================
+ Hits 182049 253630 +71581
- Misses 13378 16340 +2962
- Partials 327 9705 +9378
🚀 New features to boost your workflow:
|
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
|
|
||
| // Listener API // | ||
|
|
||
| class AsyncHook { |
There was a problem hiding this comment.
Oh wait, I thought we were keeping the approach from #61030 - leave the public API alone and create an internal version for inspector that ignores promises. If we simplify the version for inspector, the public API here should stay. If we don't simplify that, there's no need to move this class to another file.
Signed-off-by: Matteo Collina <hello@matteocollina.com>
joyeecheung
left a comment
There was a problem hiding this comment.
Code LGTM, thanks, with a comment on an unnecessary test
| @@ -0,0 +1,44 @@ | |||
| 'use strict'; | |||
|
|
|||
| // The inspector and the node.async_hooks trace event category install async | |||
There was a problem hiding this comment.
I don't think this test is necessary, we already have enough setAsyncCallStackDepth tests that would've otherwise fail if the internal async hooks don't work correctly.
async_hooks.createHook()now emits a DEP0212 deprecation warning. This is the first step of the deprecation cycle suggested in #61030 (comment): warn in the 27 alpha, then require--enable-async-hooksin 27 current.The public
AsyncHookclass is unchanged. The inspector and thenode.async_hookstrace event category switch to a minimalInternalAsyncHookininternal/async_hooks, so enabling them does not emit the warning. Trace events still track promises (it emits thePROMISEevents from JavaScript), so that is now covered intest-trace-events-async-hooks.js.Printing the warning schedules a tick that a freshly enabled hook sees without a matching
init, so the tests that check exact hook invocations now run with--no-deprecation.Refs: #61030