@@ -258,13 +258,13 @@ namespace FourSlash {
258258 let startResolveFileRef : FourSlashFile ;
259259
260260 let configFileName : string ;
261- ts . forEach ( testData . files , file => {
261+ for ( const file of testData . files ) {
262262 // Create map between fileName and its content for easily looking up when resolveReference flag is specified
263263 this . inputFiles . set ( file . fileName , file . content ) ;
264- if ( isTsconfig ( file ) ) {
264+ if ( isConfig ( file ) ) {
265265 const configJson = ts . parseConfigFileTextToJson ( file . fileName , file . content ) ;
266266 if ( configJson . config === undefined ) {
267- throw new Error ( `Failed to parse test tsconfig.json : ${ configJson . error . messageText } ` ) ;
267+ throw new Error ( `Failed to parse test ${ file . fileName } : ${ configJson . error . messageText } ` ) ;
268268 }
269269
270270 // Extend our existing compiler options so that we can also support tsconfig only options
@@ -286,7 +286,7 @@ namespace FourSlash {
286286 // If entry point for resolving file references is already specified, report duplication error
287287 throw new Error ( "There exists a Fourslash file which has resolveReference flag specified; remove duplicated resolveReference flag" ) ;
288288 }
289- } ) ;
289+ }
290290
291291 if ( configFileName ) {
292292 const baseDir = ts . normalizePath ( ts . getDirectoryPath ( configFileName ) ) ;
@@ -295,12 +295,7 @@ namespace FourSlash {
295295 const configJsonObj = ts . parseConfigFileTextToJson ( configFileName , this . inputFiles . get ( configFileName ) ) ;
296296 assert . isTrue ( configJsonObj . config !== undefined ) ;
297297
298- const { options, errors } = ts . parseJsonConfigFileContent ( configJsonObj . config , host , baseDir ) ;
299-
300- // Extend our existing compiler options so that we can also support tsconfig only options
301- if ( ! errors || errors . length === 0 ) {
302- compilationOptions = ts . extend ( compilationOptions , options ) ;
303- }
298+ compilationOptions = ts . parseJsonConfigFileContent ( configJsonObj . config , host , baseDir , compilationOptions , configFileName ) . options ;
304299 }
305300
306301
@@ -3401,13 +3396,14 @@ ${code}
34013396 }
34023397
34033398 // @Filename is the only directive that can be used in a test that contains tsconfig.json file.
3404- if ( files . some ( isTsconfig ) ) {
3399+ const config = ts . find ( files , isConfig ) ;
3400+ if ( config ) {
34053401 let directive = getNonFileNameOptionInFileList ( files ) ;
34063402 if ( ! directive ) {
34073403 directive = getNonFileNameOptionInObject ( globalOptions ) ;
34083404 }
34093405 if ( directive ) {
3410- throw Error ( " It is not allowed to use tsconfig.json along with directive '" + directive + "'" ) ;
3406+ throw Error ( ` It is not allowed to use ${ config . fileName } along with directive '${ directive } '` ) ;
34113407 }
34123408 }
34133409
@@ -3420,8 +3416,8 @@ ${code}
34203416 } ;
34213417 }
34223418
3423- function isTsconfig ( file : FourSlashFile ) : boolean {
3424- return ts . getBaseFileName ( file . fileName ) . toLowerCase ( ) === "tsconfig.json" ;
3419+ function isConfig ( file : FourSlashFile ) : boolean {
3420+ return Harness . getConfigNameFromFileName ( file . fileName ) !== undefined ;
34253421 }
34263422
34273423 function getNonFileNameOptionInFileList ( files : FourSlashFile [ ] ) : string {
0 commit comments