diff --git a/test/parallel/test-tls-env-extra-ca-file-load.js b/test/parallel/test-tls-env-extra-ca-file-load.js index 2c6119f0a53d32..75d7c17c1f1ee3 100644 --- a/test/parallel/test-tls-env-extra-ca-file-load.js +++ b/test/parallel/test-tls-env-extra-ca-file-load.js @@ -16,14 +16,7 @@ const { fork } = require('child_process'); // This test ensures that extra certificates are loaded at startup. if (process.argv[2] !== 'child') { - if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') { - assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true); - } else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'no') { - assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false); - tls.createServer({}); - assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false); - } -} else { + // Parent const NODE_EXTRA_CA_CERTS = fixtures.path('keys', 'ca1-cert.pem'); const extendsEnv = (obj) => ({ ...process.env, ...obj }); @@ -37,4 +30,12 @@ if (process.argv[2] !== 'child') { assert.strictEqual(status, 0); })); }); +} else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') { + // Child with extra certificates loaded at startup. + assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true); +} else { + // Child without extra certificates. + assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false); + tls.createServer({}); + assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false); }