node/test/parallel/test-process-features.js
Joyee Cheung 4fba01911d
process: add process.features.require_module
For detecting whether `require(esm)` is supported without triggering
the experimental warning.

PR-URL: https://github.com/nodejs/node/pull/55241
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:41 +01:00

23 lines
397 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const keys = new Set(Object.keys(process.features));
assert.deepStrictEqual(keys, new Set([
'inspector',
'debug',
'uv',
'ipv6',
'require_module',
'tls_alpn',
'tls_sni',
'tls_ocsp',
'tls',
'cached_builtins',
]));
for (const key of keys) {
assert.strictEqual(typeof process.features[key], 'boolean');
}