diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-11-24 16:29:38 -0500 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-28 02:36:34 +0100 |
commit | 1c1ef3c3b0b3a8b4b95c5d6b854364f53f120555 (patch) | |
tree | 19319bedede3b282bade1d773ed2dde8189edb16 /test/parallel/test-module-builtin.js | |
parent | 5fdf02b1e5c539ae86a91c19ff8941d44d1225a9 (diff) | |
download | android-node-v8-1c1ef3c3b0b3a8b4b95c5d6b854364f53f120555.tar.gz android-node-v8-1c1ef3c3b0b3a8b4b95c5d6b854364f53f120555.tar.bz2 android-node-v8-1c1ef3c3b0b3a8b4b95c5d6b854364f53f120555.zip |
module: add builtinModules
Provides list of all builtin modules in Node.
Includes modules of all types:
- prefixed (ex: _tls_common)
- deprecated (ex: sys)
- regular (ex: vm)
PR-URL: https://github.com/nodejs/node/pull/16386
Refs: https://github.com/nodejs/node/issues/3307
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-module-builtin.js')
-rw-r--r-- | test/parallel/test-module-builtin.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/parallel/test-module-builtin.js b/test/parallel/test-module-builtin.js new file mode 100644 index 0000000000..3897d71ecf --- /dev/null +++ b/test/parallel/test-module-builtin.js @@ -0,0 +1,14 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { builtinModules } = require('module'); + +// Includes modules in lib/ (even deprecated ones) +assert(builtinModules.includes('http')); +assert(builtinModules.includes('sys')); + +// Does not include internal modules +assert.deepStrictEqual( + builtinModules.filter((mod) => mod.startsWith('internal/')), + [] +); |