Skip to content

Commit 41644ee

Browse files
anonrigUlisesGascon
authored andcommitted
test: improve UV_THREADPOOL_SIZE tests on .env
PR-URL: #49213 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
1 parent 1db44b9 commit 41644ee

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UV_THREADPOOL_SIZE=4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
const common = require('../../common');
4+
const assert = require('assert');
5+
const path = require('path');
6+
const { spawnSync } = require('child_process');
7+
8+
if (process.config.variables.node_without_node_options) {
9+
common.skip('missing NODE_OPTIONS support');
10+
}
11+
12+
const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env';
13+
14+
// Should update UV_THREADPOOL_SIZE
15+
let filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
16+
if (common.isWindows) {
17+
filePath = filePath.replaceAll('\\', '\\\\');
18+
}
19+
const code = `
20+
const { test } = require('${filePath}');
21+
const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
22+
require('assert').strictEqual(size, 4);
23+
test(size);
24+
`.trim();
25+
const child = spawnSync(
26+
process.execPath,
27+
[ `--env-file=${uvThreadPoolPath}`, '--eval', code ],
28+
{ cwd: __dirname, encoding: 'utf-8' },
29+
);
30+
assert.strictEqual(child.stderr, '');
31+
assert.strictEqual(child.status, 0);

test/parallel/test-dotenv-node-options.js

-13
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,4 @@ describe('.env supports NODE_OPTIONS', () => {
6262
assert.strictEqual(child.code, 0);
6363
});
6464

65-
it('should update UV_THREADPOOL_SIZE', async () => {
66-
const code = `
67-
require('assert').strictEqual(process.env.UV_THREADPOOL_SIZE, '5')
68-
`.trim();
69-
const child = await common.spawnPromisified(
70-
process.execPath,
71-
[ `--env-file=${relativePath}`, '--eval', code ],
72-
{ cwd: __dirname },
73-
);
74-
assert.strictEqual(child.stderr, '');
75-
assert.strictEqual(child.code, 0);
76-
});
77-
7865
});

0 commit comments

Comments
 (0)