blob: e9d6112da752f8aa6de3f5afae761c8238fe63bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
'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;
const lookupResults = _module._resolveLookupPaths(moduleName);
let paths = lookupResults[1];
assertFunction(paths[0], '.');
paths = _module._resolveLookupPaths(moduleName, null, true);
assertFunction(paths && paths[0], '.');
}
testFirstInPath('./lodash', true);
// Relative path on Windows, but a regular file name elsewhere
testFirstInPath('.\\lodash', common.isWindows);
|