We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d22b2a9 commit 6f72d87Copy full SHA for 6f72d87
test/parallel/test-timers-unref-leak.js
@@ -0,0 +1,25 @@
1
+var assert = require('assert');
2
+
3
+var called = 0;
4
+var closed = 0;
5
6
+var timeout = setTimeout(function() {
7
+ called++;
8
+}, 10);
9
+timeout.unref();
10
11
+// Wrap `close` method to check if the handle was closed
12
+var close = timeout._handle.close;
13
+timeout._handle.close = function() {
14
+ closed++;
15
+ return close.apply(this, arguments);
16
+};
17
18
+// Just to keep process alive and let previous timer's handle die
19
+setTimeout(function() {
20
+}, 50);
21
22
+process.on('exit', function() {
23
+ assert.equal(called, 1);
24
+ assert.equal(closed, 1);
25
+});
0 commit comments