「captureRejections」 property not works in ts-node
See original GitHub issueSearch Terms
I wanna create a eventEmitter with 「captureRejections」 it works in with node.js but not works with ts-node
Expected Behavior
create a eventEmitter instance with able to capture promise rejections with ts-node
Actual Behavior
「captureRejections」property not work with ts-node but works with node
Steps to reproduce the problem
create a file testEvent.js
const { EventEmitter } = require('events');
const ee = new EventEmitter({ captureRejections: true });
console.log(ee)
run
ts-node testEvent.js
check console output
EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(kCapture)]: false
}
[Symbol(kCapture)]: false means 「captureRejections」property is not setted
however, when i use node
run
node testEvent.js
console output
EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(kCapture)]: true
}
[Symbol(kCapture)]: false means 「captureRejections」works
this is so confusing
Minimal reproduction
Specifications
-
ts-node version: v10.4.0
-
node version: v14.15.0
-
TypeScript version: 4.4.4
-
tsconfig.json, if you’re using one: not use
-
Operating system and version: macos 10.15.5 (19F101)
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Top Results From Across the Web
'ts-node' is not recognized as an internal or external command ...
I just encountered a similar issue: on Mac OS --exec ts-node works, on Windows it ...
Read more >Worker | typescript - v3.7.7
captureRejections. Defined in node_modules/@types/node/events.d.ts:49. Sets or gets the default captureRejection value for all emitters.
Read more >StreamableRowPromise | couchbase
captureRejections : boolean. Inherited from StreamablePromise.captureRejections. Defined in node_modules/@types/node/events.d.ts:278.
Read more >Node.js v19.3.0 Documentation
Working with JavaScript values and abstract operations ... node:crypto module methods and properties ... captureRejections; events.
Read more >neovim - Neovim
Defined in node_modules/@types/node/events.d.ts:273 ... captureRejections: boolean ... Map of process properties, or null if process not found ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I see, you are saying that the node REPL exhibits this bug? Then it is a node bug?
I modified your
testEvent.js
And the bug reproduces on the latest node v17.3.0:
Oh I found it https://github.com/nodejs/node/issues/41391