@@ -4,20 +4,22 @@ const common = require('../common');
44const assert = require ( 'assert' ) ;
55const _module = require ( 'module' ) ; // avoid collision with global.module
66
7- function runTest ( moduleName ) {
7+ // Current directory gets highest priority for local modules
8+ function testFirstInPath ( moduleName , isLocalModule ) {
9+ const assertFunction = isLocalModule ?
10+ assert . strictEqual :
11+ assert . notStrictEqual ;
12+
813 const lookupResults = _module . _resolveLookupPaths ( moduleName ) ;
9- let paths = lookupResults [ 1 ] ;
1014
11- // Current directory gets highest priority for local modules
12- assert . strictEqual ( paths [ 0 ] , '.' ) ;
15+ let paths = lookupResults [ 1 ] ;
16+ assertFunction ( paths [ 0 ] , '.' ) ;
1317
1418 paths = _module . _resolveLookupPaths ( moduleName , null , true ) ;
15-
16- // Current directory gets highest priority for local modules
17- assert . strictEqual ( paths && paths [ 0 ] , '.' ) ;
19+ assertFunction ( paths && paths [ 0 ] , '.' ) ;
1820}
1921
20- runTest ( './lodash' ) ;
21- if ( common . isWindows ) {
22- runTest ( '.\\lodash' ) ;
23- }
22+ testFirstInPath ( './lodash' , true ) ;
23+
24+ // Relative path on Windows, but a regular file name elsewhere
25+ testFirstInPath ( '.\\lodash' , common . isWindows ) ;
0 commit comments