GeezerVison is showing github.com — test: improve `UV_THREADPOOL_SIZE` tests on `.env` · nodejs/node@41644ee
File treeExpand file treeCollapse file tree Open diff view settings node-api/test_uv_threadpool_size
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +UV_THREADPOOL_SIZE=4 |
Collapse file Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 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); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-dotenv-node-options.js -13Lines changed: 0 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,17 +62,4 @@ describe('.env supports NODE_OPTIONS', () => { | 62 | 62 | assert.strictEqual(child.code, 0); | 63 | 63 | }); | 64 | 64 |
| 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 | | - | 78 | 65 | }); |
|