Skip to content

Commit 1154edc

Browse files
committed
fixup: test windows path everywhere
1 parent cf0e7c2 commit 1154edc

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

test/parallel/test-module-relative-lookup.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ const common = require('../common');
44
const assert = require('assert');
55
const _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

Comments
 (0)