`EXTENSIONLESS_FORMAT_JAVASCRIPT` and `EXTENSIONLESS_FORMAT_WASM` are only used internally through binding `getFormatOfExtensionlessFile`. They should not be exposed publicly. PR-URL: https://github.com/nodejs/node/pull/58327 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const constants = internalBinding('constants');
|
|
const assert = require('assert');
|
|
|
|
assert.deepStrictEqual(
|
|
Object.keys(constants).sort(), ['crypto', 'fs', 'internal', 'os', 'trace', 'zlib']
|
|
);
|
|
|
|
assert.deepStrictEqual(
|
|
Object.keys(constants.os).sort(), ['UV_UDP_REUSEADDR', 'dlopen', 'errno',
|
|
'priority', 'signals']
|
|
);
|
|
|
|
// Make sure all the constants objects don't inherit from Object.prototype
|
|
const inheritedProperties = Object.getOwnPropertyNames(Object.prototype);
|
|
function test(obj) {
|
|
assert(obj);
|
|
assert.strictEqual(Object.prototype.toString.call(obj), '[object Object]');
|
|
assert.strictEqual(Object.getPrototypeOf(obj), null);
|
|
|
|
inheritedProperties.forEach((property) => {
|
|
assert.strictEqual(property in obj, false);
|
|
});
|
|
}
|
|
|
|
[
|
|
constants, constants.crypto, constants.fs, constants.internal, constants.os, constants.trace,
|
|
constants.zlib, constants.os.dlopen, constants.os.errno, constants.os.signals,
|
|
].forEach(test);
|