diff --git a/test/abort/test-addon-uv-handle-leak.js b/test/abort/test-addon-uv-handle-leak.js index b67c5f7136af6e..87affeebf20c96 100644 --- a/test/abort/test-addon-uv-handle-leak.js +++ b/test/abort/test-addon-uv-handle-leak.js @@ -1,11 +1,9 @@ -// Flags: --experimental-worker 'use strict'; const common = require('../common'); const assert = require('assert'); const fs = require('fs'); const path = require('path'); const cp = require('child_process'); -const { Worker } = require('worker_threads'); const { spawnSync } = require('child_process'); // This is a sibling test to test/addons/uv-handle-leak. @@ -19,6 +17,8 @@ if (!fs.existsSync(bindingPath)) if (process.argv[2] === 'child') { + const { Worker } = require('worker_threads'); + // The worker thread loads and then unloads `bindingPath`. Because of this the // symbols in `bindingPath` are lost when the worker thread quits, but the // number of open handles in the worker thread's event loop is assessed in the