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 <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]>
1 parent 1db44b9 commit 41644ee

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UV_THREADPOOL_SIZE=4
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
3+
constcommon=require('../../common');
4+
constassert=require('assert');
5+
constpath=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+
constuvThreadPoolPath='../../fixtures/dotenv/uv-threadpool.env';
13+
14+
// Should update UV_THREADPOOL_SIZE
15+
letfilePath=path.join(__dirname,`./build/${common.buildType}/test_uv_threadpool_size`);
16+
if(common.isWindows){
17+
filePath=filePath.replaceAll('\\','\\\\');
18+
}
19+
constcode=`
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+
constchild=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‎

Lines changed: 0 additions & 13 deletions
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-
constcode=`
67-
require('assert').strictEqual(process.env.UV_THREADPOOL_SIZE, '5')
68-
`.trim();
69-
constchild=awaitcommon.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)