mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 16:22:29 +00:00

This removes the compatibilty code that was in place to allow an unintended interaction between `require('.')` and `NODE_PATH`. The compatibility code and the accompanying deprecation warning has been in place since 2015-04-17. PR-URL: https://github.com/nodejs/node/pull/3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
17 lines
618 B
JavaScript
17 lines
618 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const m = require('module');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const a = require(fixtures.path('module-require', 'relative', 'dot.js'));
|
|
const b = require(fixtures.path('module-require', 'relative', 'dot-slash.js'));
|
|
|
|
assert.strictEqual(a.value, 42);
|
|
assert.strictEqual(a, b, 'require(".") should resolve like require("./")');
|
|
|
|
// require('.') should not lookup in NODE_PATH
|
|
process.env.NODE_PATH = fixtures.path('module-require', 'relative');
|
|
m._initPaths();
|
|
assert.throws(() => { require('.'); }, Error, "Cannot find module '.'");
|