mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

There is no reason to hide FIPS functionality behind build flags. OpenSSL always provide the information about FIPS availability via `FIPS_mode()` function. This makes the user experience more consistent, because the OpenSSL library is always queried and the `crypto.getFips()` always returns OpenSSL settings. Fixes #34903 PR-URL: https://github.com/nodejs/node/pull/36341 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
// The following tests assert that the node.cc PrintHelp() function
|
|
// returns the proper set of cli options when invoked
|
|
|
|
const assert = require('assert');
|
|
const { exec } = require('child_process');
|
|
let stdOut;
|
|
|
|
|
|
function startPrintHelpTest() {
|
|
exec(`${process.execPath} --help`, common.mustSucceed((stdout, stderr) => {
|
|
stdOut = stdout;
|
|
validateNodePrintHelp();
|
|
}));
|
|
}
|
|
|
|
function validateNodePrintHelp() {
|
|
const HAVE_OPENSSL = common.hasCrypto;
|
|
const NODE_HAVE_I18N_SUPPORT = common.hasIntl;
|
|
const HAVE_INSPECTOR = process.features.inspector;
|
|
|
|
const cliHelpOptions = [
|
|
{ compileConstant: HAVE_OPENSSL,
|
|
flags: [ '--openssl-config=...', '--tls-cipher-list=...',
|
|
'--use-bundled-ca', '--use-openssl-ca',
|
|
'--enable-fips', '--force-fips' ] },
|
|
{ compileConstant: NODE_HAVE_I18N_SUPPORT,
|
|
flags: [ '--icu-data-dir=...', 'NODE_ICU_DATA' ] },
|
|
{ compileConstant: HAVE_INSPECTOR,
|
|
flags: [ '--inspect-brk[=[host:]port]', '--inspect-port=[host:]port',
|
|
'--inspect[=[host:]port]' ] },
|
|
];
|
|
|
|
cliHelpOptions.forEach(testForSubstring);
|
|
}
|
|
|
|
function testForSubstring(options) {
|
|
if (options.compileConstant) {
|
|
options.flags.forEach((flag) => {
|
|
assert.strictEqual(stdOut.indexOf(flag) !== -1, true,
|
|
`Missing flag ${flag} in ${stdOut}`);
|
|
});
|
|
} else {
|
|
options.flags.forEach((flag) => {
|
|
assert.strictEqual(stdOut.indexOf(flag), -1,
|
|
`Unexpected flag ${flag} in ${stdOut}`);
|
|
});
|
|
}
|
|
}
|
|
|
|
startPrintHelpTest();
|