You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
677 B

'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');