node/test/addons/uv-handle-leak/test.js
Rich Trott 5d559f4a74 test: enable no-empty ESLint rule
PR-URL: https://github.com/nodejs/node/pull/41831
Refs: https://eslint.org/docs/rules/no-empty
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-02-05 12:58:32 +00:00

26 lines
853 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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.
// Its 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 dont 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);