From 710162048b345a74ba5a2f9d7e1aeb4290072763 Mon Sep 17 00:00:00 2001 From: Sakthipriyan Vairamani Date: Thu, 17 Sep 2015 04:43:39 +0530 Subject: [PATCH] module: remove unnecessary property and method `require.path` property and `require.registerExtension` function have been throwing errors when used. They both are like this for years now. This patch removes them from the system. --- lib/module.js | 10 ---------- test/sequential/test-module-loading.js | 4 ---- 2 files changed, 14 deletions(-) diff --git a/lib/module.js b/lib/module.js index da8a906f951541..54c56501e31a3d 100644 --- a/lib/module.js +++ b/lib/module.js @@ -388,20 +388,10 @@ Module.prototype._compile = function(content, filename) { return Module._resolveFilename(request, self); }; - Object.defineProperty(require, 'paths', { get: function() { - throw new Error('require.paths is removed. Use ' + - 'node_modules folders, or the NODE_PATH ' + - 'environment variable instead.'); - }}); - require.main = process.mainModule; // Enable support to add extra extension types require.extensions = Module._extensions; - require.registerExtension = function() { - throw new Error('require.registerExtension() removed. Use ' + - 'require.extensions instead.'); - }; require.cache = Module._cache; diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index dfca2e420263b6..d708e7f21cbfaf 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -127,10 +127,6 @@ assert.equal(require('../fixtures/registerExt2').custom, 'passed'); assert.equal(require('../fixtures/foo').foo, 'ok', 'require module with no extension'); -assert.throws(function() { - require.paths; -}, /removed/, 'Accessing require.paths should throw.'); - // Should not attempt to load a directory try { require('../fixtures/empty');