Skip to content

Commit

Permalink
bring changes to test-process-versions.js from node/v16.x branch
Browse files Browse the repository at this point in the history
  • Loading branch information
denihs committed Jul 3, 2023
1 parent 44858c2 commit 9a977f2
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ if (common.hasCrypto) {
expected_keys.push('openssl');
}

if (common.hasQuic) {
expected_keys.push('ngtcp2');
expected_keys.push('nghttp3');
}

if (common.hasIntl) {
expected_keys.push('icu');
expected_keys.push('cldr');
Expand All @@ -33,19 +38,27 @@ assert.deepStrictEqual(actual_keys, expected_keys);

const commonTemplate = /^\d+\.\d+\.\d+(?:-.*)?$/;

assert(commonTemplate.test(process.versions.ares));
assert(commonTemplate.test(process.versions.brotli));
assert(commonTemplate.test(process.versions.llhttp));
assert(commonTemplate.test(process.versions.node));
assert(commonTemplate.test(process.versions.uv));
assert(commonTemplate.test(process.versions.zlib));
assert.match(process.versions.ares, commonTemplate);
assert.match(process.versions.brotli, commonTemplate);
assert.match(process.versions.llhttp, commonTemplate);
assert.match(process.versions.node, commonTemplate);
assert.match(process.versions.uv, commonTemplate);
assert.match(process.versions.zlib, commonTemplate);

assert(/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
.test(process.versions.v8));
assert(/^\d+$/.test(process.versions.modules));
assert.match(
process.versions.v8,
/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
);
assert.match(process.versions.modules, /^\d+$/);

if (common.hasCrypto) {
assert(/^\d+\.\d+\.\d+[a-z]?(-fips)?$/.test(process.versions.openssl));
const versionRegex = common.hasOpenSSL3 ?
// The following also matches a development version of OpenSSL 3.x which
// can be in the format '3.0.0-alpha4-dev'. This can be handy when building
// and linking against the main development branch of OpenSSL.
/^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ :
/^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/;
assert.match(process.versions.openssl, versionRegex);
}

for (let i = 0; i < expected_keys.length; i++) {
Expand Down

0 comments on commit 9a977f2

Please sign in to comment.