blob: e8527fe574a53a5e5fce13c85834f22cc767ce0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
'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]?(-fips)?$/.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);
}
|