@@ -11,14 +11,39 @@ describe("paths", function () {
11
11
} )
12
12
} )
13
13
14
+
15
+ describe ( "core" , function ( ) {
16
+ it ( "returns found, but null path, for core Node modules" , function ( ) {
17
+ var resolved = node . resolve ( 'fs' , "./test/file.js" )
18
+ expect ( resolved ) . has . property ( "found" , true )
19
+ expect ( resolved ) . has . property ( "path" , null )
20
+ } )
21
+ } )
22
+
23
+
14
24
describe ( "default options" , function ( ) {
25
+
15
26
it ( "finds .json files" , function ( ) {
16
- expect ( node . resolve ( './data' , './test/file.js' ) )
27
+ expect ( node . resolve ( './data' , './test/file.js' ) )
17
28
. to . have . property ( 'path' )
18
29
. equal ( path . resolve ( __dirname , './data.json' ) )
19
30
} )
31
+
20
32
it ( "ignores .json files if 'extensions' is redefined" , function ( ) {
21
- expect ( node . resolve ( './data' , './test/file.js' , { extensions : [ '.js' ] } ) )
33
+ expect ( node . resolve ( './data' , './test/file.js' , { extensions : [ '.js' ] } ) )
22
34
. to . have . property ( 'found' , false )
23
35
} )
36
+
37
+ it ( "finds mjs modules, with precedence over .js" , function ( ) {
38
+ expect ( node . resolve ( './native' , './test/file.js' ) )
39
+ . to . have . property ( 'path' )
40
+ . equal ( path . resolve ( __dirname , './native.mjs' ) )
41
+ } )
42
+
43
+ it ( "still finds .js if explicit" , function ( ) {
44
+ expect ( node . resolve ( './native.js' , './test/file.js' ) )
45
+ . to . have . property ( 'path' )
46
+ . equal ( path . resolve ( __dirname , './native.js' ) )
47
+ } )
48
+
24
49
} )
0 commit comments