File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,17 @@ export function parseConfig(
7575 return
7676 }
7777
78+ if ( parsedConfig ! . raw . include ) {
79+ parsedConfig ! . raw . include = parsedConfig ! . raw . include . map ( ( includePath : string ) => {
80+ return includePath . replace ( '${configDir}/' , '' )
81+ } )
82+ }
83+ if ( parsedConfig ! . raw . exclude ) {
84+ parsedConfig ! . raw . exclude = parsedConfig ! . raw . exclude . map ( ( excludePath : string ) => {
85+ return excludePath . replace ( '${configDir}/' , '' )
86+ } )
87+ }
88+
7889 return parsedConfig
7990}
8091
Original file line number Diff line number Diff line change @@ -37,4 +37,18 @@ test.group('Helpers | Parse config', () => {
3737 const result = parseConfig ( fs . baseUrl , ts )
3838 assert . deepEqual ( result ?. fileNames , [ string . toUnixSlash ( join ( fs . basePath , 'foo.ts' ) ) ] )
3939 } )
40+
41+ test ( 'parse tsconfig file using ${configDir} variable to point to the root dir' , async ( {
42+ assert,
43+ fs,
44+ } ) => {
45+ await fs . createJson ( 'tsconfig.json' , {
46+ include : [ '${configDir}/**/*' , '${configDir}/.adonisjs/server/**/*' ] ,
47+ } )
48+ await fs . create ( 'foo.ts' , '' )
49+
50+ const result = parseConfig ( fs . baseUrl , ts )
51+ assert . deepEqual ( result ?. fileNames , [ string . toUnixSlash ( join ( fs . basePath , 'foo.ts' ) ) ] )
52+ assert . deepEqual ( result ?. raw . include , [ '**/*' , '.adonisjs/server/**/*' ] )
53+ } )
4054} )
You can’t perform that action at this time.
0 commit comments