summaryrefslogtreecommitdiff
path: root/test/parallel/test-constants.js
diff options
context:
space:
mode:
authorBryan English <bryan@bryanenglish.com>2018-04-04 14:47:08 -0700
committerRuben Bridgewater <ruben@bridgewater.de>2018-05-07 14:26:11 +0200
commit90e8f79f652b02a8fdf6f72e273cc81429a9376a (patch)
treeb82f3e33d9c2bee9e50f07403fc2c17ad56c63a3 /test/parallel/test-constants.js
parent8444bba0afd581c00d3ebf1a698f9e6322087bdc (diff)
downloadandroid-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.tar.gz
android-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.tar.bz2
android-node-v8-90e8f79f652b02a8fdf6f72e273cc81429a9376a.zip
constants: freeze the constants object
Constants ought to be constant. The primary goal of this commit is to make constants exposed in require('constants') immutable, as they were prior to node@7.0.0, and as the constants exposed on fs.constants, crypto.constants, etc. are. Since this is implemented by using Object.freeze, it also has the side effect of making the entire exports of require('constants') immutable, so no new constants can be defined on the object in userland. PR-URL: https://github.com/nodejs/node/pull/19813 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-constants.js')
-rw-r--r--test/parallel/test-constants.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js
index c11935783f..945443d886 100644
--- a/test/parallel/test-constants.js
+++ b/test/parallel/test-constants.js
@@ -24,3 +24,5 @@ assert.ok(binding.crypto);
}
});
});
+
+assert.ok(Object.isFrozen(constants));