mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/56712 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
25 lines
705 B
JavaScript
25 lines
705 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const _module = require('module'); // Avoid collision with globalThis.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?.[0], '.');
|
|
}
|
|
|
|
testFirstInPath('./lodash', true);
|
|
|
|
// Relative path on Windows, but a regular file name elsewhere
|
|
testFirstInPath('.\\lodash', common.isWindows);
|