node/test/parallel/test-require-dot.js
Roman Reiss a517466aa7
module: mark DEP0019 as EOL and remove compat code
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>
2017-08-31 21:11:49 +02:00

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 '.'");