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.

35 lines
625 B

var assert = require( 'assert' );
module.exports = {
description: 'namespaces should be non-extensible and its properties immutatable and non-configurable',
exports: function ( exports ) {
const ns = exports.ns;
function extend ( obj ) {
'use strict';
obj.newProperty = true;
}
function reconfigure ( obj ) {
Object.defineProperty( obj, 'a', { value: null } );
}
function mutate ( obj ) {
'use strict';
obj.a = 2;
}
assert.throws(function () {
extend( ns );
});
assert.throws(function () {
reconfigure( ns );
});
assert.throws(function () {
mutate( ns );
});
}
};