11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst bindingPath = require.resolve(`./build/${common.buildType}/binding`);
41cb0ef41Sopenharmony_ciconst binding = require(bindingPath);
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci// This tests checks that addons may leak libuv handles until process exit.
71cb0ef41Sopenharmony_ci// It’s really not a good idea to do so, but it tests existing behaviour
81cb0ef41Sopenharmony_ci// that likely can never be removed for backwards compatibility.
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci// This has a sibling test in test/abort/ which checks output for failures
111cb0ef41Sopenharmony_ci// from workers.
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_citry {
141cb0ef41Sopenharmony_ci  // We don’t want to run this in Workers because they do actually enforce
151cb0ef41Sopenharmony_ci  // a clean-exit policy.
161cb0ef41Sopenharmony_ci  const { isMainThread } = require('worker_threads');
171cb0ef41Sopenharmony_ci  if (!isMainThread)
181cb0ef41Sopenharmony_ci    common.skip('Cannot run test in environment with clean-exit policy');
191cb0ef41Sopenharmony_ci} catch {
201cb0ef41Sopenharmony_ci  // Continue regardless of error.
211cb0ef41Sopenharmony_ci}
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_cibinding.leakHandle();
241cb0ef41Sopenharmony_cibinding.leakHandle(0);
251cb0ef41Sopenharmony_cibinding.leakHandle(1);
26