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