Skip to content

Commit

Permalink
fixup! test: improve UV_THREADPOOL_SIZE tests on .env
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Aug 18, 2023
1 parent 7b7c6e0 commit e4c08f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/parallel/test-dotenv-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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) {
Expand Down Expand Up @@ -59,9 +60,11 @@ describe('.env supports NODE_OPTIONS', () => {
});

it('should update UV_THREADPOOL_SIZE', async () => {
const filePath = path.join(__dirname, `../node-api/test_uv_threadpool_size/build/${common.buildType}/test_uv_threadpool_size`);
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);
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(
Expand Down

0 comments on commit e4c08f4

Please sign in to comment.