• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const _module = require('module'); // Avoid collision with global.module
6
7// Current directory gets highest priority for local modules
8function testFirstInPath(moduleName, isLocalModule) {
9  const assertFunction = isLocalModule ?
10    assert.strictEqual :
11    assert.notStrictEqual;
12
13  let paths = _module._resolveLookupPaths(moduleName);
14
15  assertFunction(paths[0], '.');
16
17  paths = _module._resolveLookupPaths(moduleName, null);
18  assertFunction(paths && paths[0], '.');
19}
20
21testFirstInPath('./lodash', true);
22
23// Relative path on Windows, but a regular file name elsewhere
24testFirstInPath('.\\lodash', common.isWindows);
25