diff --git a/test/node-api/test_uv_threadpool_size/node-options.js b/test/node-api/test_uv_threadpool_size/node-options.js new file mode 100644 index 00000000000000..7f56cea72816b7 --- /dev/null +++ b/test/node-api/test_uv_threadpool_size/node-options.js @@ -0,0 +1,33 @@ +'use strict'; + +const common = require('../../common'); +const assert = require('node:assert'); +const path = require('node:path'); +const { describe, it } = require('node:test'); + +if (process.config.variables.node_without_node_options) { + common.skip('missing NODE_OPTIONS support'); +} + +const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env'; + +describe('.env supports NODE_OPTIONS', () => { + + it('should update UV_THREADPOOL_SIZE', async () => { + const filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`); + const code = ` + const { test } = require('${filePath}'); + const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10); + require('assert').strictEqual(size, 5); + test(size); + `.trim(); + const child = await common.spawnPromisified( + process.execPath, + [ `--env-file=${uvThreadPoolPath}`, '--eval', code ], + { cwd: __dirname }, + ); + assert.strictEqual(child.stderr, ''); + assert.strictEqual(child.code, 0); + }); + +}); diff --git a/test/parallel/test-dotenv-node-options.js b/test/parallel/test-dotenv-node-options.js index 8a760c6a75b0c4..d0fe177327754d 100644 --- a/test/parallel/test-dotenv-node-options.js +++ b/test/parallel/test-dotenv-node-options.js @@ -9,7 +9,6 @@ if (process.config.variables.node_without_node_options) { } const nodeOptionsPath = '../fixtures/dotenv/node-options.env'; -const uvThreadPoolPath = '../fixtures/dotenv/uv-threadpool.env'; describe('.env supports NODE_OPTIONS', () => { @@ -58,19 +57,4 @@ describe('.env supports NODE_OPTIONS', () => { assert.strictEqual(child.code, 0); }); - it('should update UV_THREADPOOL_SIZE', async () => { - const code = ` - const { test } = require('../node-api/test_uv_threadpool_size/build/${common.buildType}/test_uv_threadpool_size'); - const size = parseInt(process.env.UV_THREADPOOL_SIZE || 4, 10); - test(size); - `.trim(); - const child = await common.spawnPromisified( - process.execPath, - [ `--env-file=${uvThreadPoolPath}`, '--eval', code ], - { cwd: __dirname }, - ); - assert.strictEqual(child.stderr, ''); - assert.strictEqual(child.code, 0); - }); - });