-
Notifications
You must be signed in to change notification settings - Fork 28.3k
/
test.js
25 lines (21 loc) · 852 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const common = require('../../common');
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
const binding = require(bindingPath);
// This tests checks that addons may leak libuv handles until process exit.
// It’s really not a good idea to do so, but it tests existing behaviour
// that likely can never be removed for backwards compatibility.
// This has a sibling test in test/abort/ which checks output for failures
// from workers.
try {
// We don’t want to run this in Workers because they do actually enforce
// a clean-exit policy.
const { isMainThread } = require('worker_threads');
if (!isMainThread)
common.skip('Cannot run test in environment with clean-exit policy');
} catch {
// Continue regardless of error
}
binding.leakHandle();
binding.leakHandle(0);
binding.leakHandle(1);