node/test/parallel/test-module-relative-lookup.js
Ruben Bridgewater d11c4beb4b
module: remove dead code
This removes a lot of code that has no functionality anymore. All
Node.js internal code calls `_resolveLookupPaths` with two arguments.

The code that validates `index.js` is not required at all as we check
for these files anyway, so it's just redundant code that should be
removed.

PR-URL: https://github.com/nodejs/node/pull/26983
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-04-08 18:56:17 +02:00

25 lines
708 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const _module = require('module'); // Avoid collision with global.module
// Current directory gets highest priority for local modules
function testFirstInPath(moduleName, isLocalModule) {
const assertFunction = isLocalModule ?
assert.strictEqual :
assert.notStrictEqual;
let paths = _module._resolveLookupPaths(moduleName);
assertFunction(paths[0], '.');
paths = _module._resolveLookupPaths(moduleName, null);
assertFunction(paths && paths[0], '.');
}
testFirstInPath('./lodash', true);
// Relative path on Windows, but a regular file name elsewhere
testFirstInPath('.\\lodash', common.isWindows);