Skip to content

Commit 6a0acc8

Browse files
Tim van den Eijndenljharb
authored andcommitted
[Tests] add test cases for resolving path on Windows networked drives
1 parent 14d08be commit 6a0acc8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/node-modules-paths.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,26 @@ test('node-modules-paths', function (t) {
118118

119119
t.end();
120120
});
121+
122+
t.test('combine paths correctly on Windows', function (t) {
123+
var start = 'C:\\Users\\username\\myProject\\src';
124+
var paths = [];
125+
var moduleDirectories = ['node_modules', start];
126+
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
127+
128+
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
129+
130+
t.end();
131+
});
132+
133+
t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) {
134+
var start = '/Users/username/git/myProject/src';
135+
var paths = [];
136+
var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src'];
137+
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
138+
139+
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
140+
141+
t.end();
142+
});
121143
});

0 commit comments

Comments
 (0)