mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 09:21:23 +00:00

* use const instead of var * use assert.strictEqual instead assert.equal PR-URL https://github.com/nodejs/node/pull/10428 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
677 B
JavaScript
26 lines
677 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
const vm = require('vm');
|
|
|
|
const x = {};
|
|
Object.defineProperty(x, 'prop', {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: 'val'
|
|
});
|
|
const o = vm.createContext(x);
|
|
|
|
const code = 'Object.getOwnPropertyDescriptor(this, "prop")';
|
|
const res = vm.runInContext(code, o, 'test');
|
|
|
|
assert(res);
|
|
assert.strictEqual(typeof res, 'object');
|
|
assert.strictEqual(res.value, 'val');
|
|
assert.strictEqual(res.configurable, false, 'should not be configurable');
|
|
assert.strictEqual(res.enumerable, false, 'should not be enumerable');
|
|
assert.strictEqual(res.writable, false, 'should not be writable');
|