mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 20:06:58 +00:00

Remove trailing " \n" from `process.versions.openssl`.d3d6cd3eca
was incorrectly printing this trailer, but because the target buffer size was claimed to be the length of the version string, the trailer was truncated off.9ed4646df0
corrected the target buffer size, but then the trailer started to appear in process.versions. Added a test to check for regressions. PR-URL: https://github.com/nodejs/node/pull/23678 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const expected_keys = ['ares', 'http_parser', 'modules', 'node',
|
|
'uv', 'v8', 'zlib', 'nghttp2', 'napi'];
|
|
|
|
if (common.hasCrypto) {
|
|
expected_keys.push('openssl');
|
|
}
|
|
|
|
if (common.hasIntl) {
|
|
expected_keys.push('icu');
|
|
expected_keys.push('cldr');
|
|
expected_keys.push('tz');
|
|
expected_keys.push('unicode');
|
|
}
|
|
|
|
expected_keys.sort();
|
|
const actual_keys = Object.keys(process.versions).sort();
|
|
|
|
assert.deepStrictEqual(actual_keys, expected_keys);
|
|
|
|
const commonTemplate = /^\d+\.\d+\.\d+(?:-.*)?$/;
|
|
|
|
assert(commonTemplate.test(process.versions.ares));
|
|
assert(commonTemplate.test(process.versions.http_parser));
|
|
assert(commonTemplate.test(process.versions.node));
|
|
assert(commonTemplate.test(process.versions.uv));
|
|
assert(commonTemplate.test(process.versions.zlib));
|
|
|
|
assert(/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
|
|
.test(process.versions.v8));
|
|
assert(/^\d+$/.test(process.versions.modules));
|
|
|
|
if (common.hasCrypto) {
|
|
assert(/^\d+\.\d+\.\d+[a-z]?$/.test(process.versions.openssl));
|
|
}
|
|
|
|
for (let i = 0; i < expected_keys.length; i++) {
|
|
const key = expected_keys[i];
|
|
const descriptor = Object.getOwnPropertyDescriptor(process.versions, key);
|
|
assert.strictEqual(descriptor.writable, false);
|
|
}
|