File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments