@@ -51,7 +51,7 @@ describe('importType(name)', function () {
51
51
const pathContext = testContext ( { 'import/resolver' : { node : { paths : [ pathToTestFiles ] } } } )
52
52
expect ( importType ( '@importType/index' , pathContext ) ) . to . equal ( 'internal' )
53
53
} )
54
-
54
+
55
55
it ( "should return 'internal' for internal modules that are referenced by aliases" , function ( ) {
56
56
const pathContext = testContext ( { 'import/resolver' : { node : { paths : [ pathToTestFiles ] } } } )
57
57
expect ( importType ( '@my-alias/fn' , pathContext ) ) . to . equal ( 'internal' )
@@ -130,6 +130,16 @@ describe('importType(name)', function () {
130
130
expect ( importType ( 'resolve' , foldersContext ) ) . to . equal ( 'internal' )
131
131
} )
132
132
133
+ it ( "should return 'internal' for module from 'node_modules' if its name matched 'internal-regex'" , function ( ) {
134
+ const foldersContext = testContext ( { 'import/internal-regex' : '^@org' } )
135
+ expect ( importType ( '@org/foobar' , foldersContext ) ) . to . equal ( 'internal' )
136
+ } )
137
+
138
+ it ( "should return 'external' for module from 'node_modules' if its name did not match 'internal-regex'" , function ( ) {
139
+ const foldersContext = testContext ( { 'import/internal-regex' : '^@bar' } )
140
+ expect ( importType ( '@org/foobar' , foldersContext ) ) . to . equal ( 'external' )
141
+ } )
142
+
133
143
it ( "should return 'external' for module from 'node_modules' if 'node_modules' contained in 'external-module-folders'" , function ( ) {
134
144
const foldersContext = testContext ( { 'import/external-module-folders' : [ 'node_modules' ] } )
135
145
expect ( importType ( 'resolve' , foldersContext ) ) . to . equal ( 'external' )
0 commit comments