0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-disable-proto-delete.js
Rich Trott e2e2bc83c0
test: use Object.hasOwn() where applicable
Replace Object.prototpye.hasOwnProperty() with Object.hasOwn() where
applicable.

PR-URL: https://github.com/nodejs/node/pull/41664
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-01-25 07:03:17 +00:00

26 lines
672 B
JavaScript

// Flags: --disable-proto=delete
'use strict';
require('../common');
const assert = require('assert');
const vm = require('vm');
const { Worker, isMainThread } = require('worker_threads');
// eslint-disable-next-line no-proto
assert.strictEqual(Object.prototype.__proto__, undefined);
assert(!Object.hasOwn(Object.prototype, '__proto__'));
const ctx = vm.createContext();
const ctxGlobal = vm.runInContext('this', ctx);
// eslint-disable-next-line no-proto
assert.strictEqual(ctxGlobal.Object.prototype.__proto__, undefined);
assert(!Object.hasOwn(ctxGlobal.Object.prototype, '__proto__'));
if (isMainThread) {
new Worker(__filename);
} else {
process.exit();
}