@@ -471,7 +471,7 @@ describe('makeDiagnostic', () => {
471471
472472describe ( 'typescript' , ( ) => {
473473 const get = ( tsJest ?: TsJestGlobalOptions , parentConfig ?: TsJestGlobalOptions ) =>
474- createConfigSet ( { tsJestConfig : tsJest , parentConfig } ) . typescript
474+ createConfigSet ( { tsJestConfig : tsJest , parentConfig } ) . parsedTsConfig
475475
476476 it ( 'should read file list from default tsconfig' , ( ) => {
477477 // since the default is to lookup for tsconfig, but we set include to [] so we should not have this file in the list
@@ -502,7 +502,7 @@ describe('typescript', () => {
502502 tsJestConfig : { tsConfig : 'tsconfig.build.json' } ,
503503 resolve : null ,
504504 } )
505- expect ( cs . typescript . options ) . toMatchObject ( {
505+ expect ( cs . parsedTsConfig . options ) . toMatchObject ( {
506506 module : ts . ModuleKind . CommonJS ,
507507 rootDir : normalizeSlashes ( resolve ( __dirname , '..' ) ) ,
508508 skipLibCheck : true ,
@@ -519,7 +519,7 @@ describe('typescript', () => {
519519 } ,
520520 resolve : null ,
521521 } )
522- expect ( cs . typescript . options ) . toMatchObject ( {
522+ expect ( cs . parsedTsConfig . options ) . toMatchObject ( {
523523 module : ts . ModuleKind . CommonJS ,
524524 allowSyntheticDefaultImports : true ,
525525 esModuleInterop : false ,
@@ -541,11 +541,11 @@ describe('typescript', () => {
541541 } ,
542542 resolve : null ,
543543 } )
544- expect ( cs . typescript . options ) . toMatchObject ( {
544+ expect ( cs . parsedTsConfig . options ) . toMatchObject ( {
545545 module : ts . ModuleKind . AMD ,
546546 esModuleInterop : false ,
547547 } )
548- expect ( cs . typescript . options . allowSyntheticDefaultImports ) . toBeFalsy ( )
548+ expect ( cs . parsedTsConfig . options . allowSyntheticDefaultImports ) . toBeFalsy ( )
549549 expect ( target . lines . warn ) . toHaveLength ( 0 )
550550 } )
551551} ) // typescript
@@ -582,11 +582,13 @@ describe('readTsConfig', () => {
582582 let readConfig ! : jest . SpyInstance < { config ?: any ; error ?: ts . Diagnostic } >
583583 let parseConfig ! : jest . SpyInstance < ts . ParsedCommandLine >
584584 let cs ! : ConfigSet
585+
585586 beforeAll ( ( ) => {
586587 findConfig = jest . spyOn ( ts , 'findConfigFile' )
587588 readConfig = jest . spyOn ( ts , 'readConfigFile' )
588589 parseConfig = jest . spyOn ( ts , 'parseJsonConfigFileContent' )
589590 } )
591+
590592 afterAll ( ( ) => {
591593 findConfig . mockRestore ( )
592594 readConfig . mockRestore ( )
@@ -603,6 +605,7 @@ describe('readTsConfig', () => {
603605 } as any ,
604606 } )
605607 } )
608+
606609 afterEach ( ( ) => {
607610 findConfig . mockClear ( )
608611 readConfig . mockClear ( )
@@ -611,7 +614,7 @@ describe('readTsConfig', () => {
611614
612615 it ( 'should use correct paths when searching' , ( ) => {
613616 const conf = cs . readTsConfig ( )
614- expect ( conf . input ) . toBeUndefined ( )
617+ expect ( conf . options . configFilePath ) . toBeUndefined ( )
615618 expect ( readConfig ) . not . toHaveBeenCalled ( )
616619 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
617620 expect . objectContaining ( {
@@ -621,9 +624,10 @@ describe('readTsConfig', () => {
621624 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
622625 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBeUndefined ( )
623626 } )
627+
624628 it ( 'should use given tsconfig path' , ( ) => {
625629 const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
626- expect ( conf . input ) . toBeUndefined ( )
630+ expect ( conf . options . configFilePath ) . toBeUndefined ( )
627631 expect ( findConfig ) . not . toBeCalled ( )
628632 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
629633 expect ( parseConfig ) . not . toHaveBeenCalled ( )
@@ -636,10 +640,12 @@ describe('readTsConfig', () => {
636640 findConfig . mockImplementation ( p => `${ p } /tsconfig.json` )
637641 readConfig . mockImplementation ( p => ( { config : { path : p , compilerOptions : { } } } ) )
638642 } )
643+
639644 afterEach ( ( ) => {
640645 findConfig . mockClear ( )
641646 readConfig . mockClear ( )
642647 } )
648+
643649 describe ( 'module in tsConfig is not the same as forced module and esModuleInterop is not in tsConfig' , ( ) => {
644650 beforeEach ( ( ) => {
645651 parseConfig . mockImplementation ( ( conf : any ) => ( {
@@ -651,13 +657,14 @@ describe('readTsConfig', () => {
651657 errors : [ ] ,
652658 } ) )
653659 } )
660+
654661 afterEach ( ( ) => {
655662 parseConfig . mockClear ( )
656663 } )
657664
658665 it ( 'should use correct paths when searching' , ( ) => {
659666 const conf = cs . readTsConfig ( )
660- expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
667+ expect ( conf . options . path ) . toBe ( '/root/tsconfig.json' )
661668 expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
662669 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
663670 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -667,13 +674,13 @@ describe('readTsConfig', () => {
667674 )
668675 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
669676 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
670- expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
671- expect ( conf . resolved . errors ) . toMatchSnapshot ( )
677+ expect ( conf . options . allowSyntheticDefaultImports ) . toEqual ( true )
678+ expect ( conf . errors ) . toMatchSnapshot ( )
672679 } )
673680
674681 it ( 'should use given tsconfig path' , ( ) => {
675682 const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
676- expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
683+ expect ( conf . options . path ) . toBe ( '/foo/tsconfig.bar.json' )
677684 expect ( findConfig ) . not . toBeCalled ( )
678685 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
679686 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -683,7 +690,7 @@ describe('readTsConfig', () => {
683690 )
684691 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
685692 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
686- expect ( conf . resolved . errors ) . toMatchSnapshot ( )
693+ expect ( conf . errors ) . toMatchSnapshot ( )
687694 } )
688695 } )
689696
@@ -699,13 +706,14 @@ describe('readTsConfig', () => {
699706 errors : [ ] ,
700707 } ) )
701708 } )
709+
702710 afterEach ( ( ) => {
703711 parseConfig . mockClear ( )
704712 } )
705713
706714 it ( 'should use correct paths when searching' , ( ) => {
707715 const conf = cs . readTsConfig ( )
708- expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
716+ expect ( conf . options . path ) . toBe ( '/root/tsconfig.json' )
709717 expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
710718 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
711719 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -715,18 +723,18 @@ describe('readTsConfig', () => {
715723 )
716724 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
717725 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
718- expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
719- expect ( conf . resolved . errors ) . toMatchSnapshot ( )
726+ expect ( conf . options . allowSyntheticDefaultImports ) . toEqual ( true )
727+ expect ( conf . errors ) . toMatchSnapshot ( )
720728 } )
721729
722730 it ( 'should use given tsconfig path' , ( ) => {
723731 const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
724- expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
732+ expect ( conf . options . path ) . toBe ( '/foo/tsconfig.bar.json' )
725733 expect ( findConfig ) . not . toBeCalled ( )
726734 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
727735 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
728736 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
729- expect ( conf . resolved . errors ) . toMatchSnapshot ( )
737+ expect ( conf . errors ) . toMatchSnapshot ( )
730738 } )
731739 } )
732740
@@ -742,13 +750,14 @@ describe('readTsConfig', () => {
742750 errors : [ ] ,
743751 } ) )
744752 } )
753+
745754 afterEach ( ( ) => {
746755 parseConfig . mockClear ( )
747756 } )
748757
749758 it ( 'should use correct paths when searching' , ( ) => {
750759 const conf = cs . readTsConfig ( )
751- expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
760+ expect ( conf . options . path ) . toBe ( '/root/tsconfig.json' )
752761 expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
753762 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
754763 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -758,13 +767,13 @@ describe('readTsConfig', () => {
758767 )
759768 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
760769 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
761- expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toBeUndefined ( )
762- expect ( conf . resolved . errors ) . toEqual ( [ ] )
770+ expect ( conf . options . allowSyntheticDefaultImports ) . toBeUndefined ( )
771+ expect ( conf . errors ) . toEqual ( [ ] )
763772 } )
764773
765774 it ( 'should use given tsconfig path' , ( ) => {
766775 const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
767- expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
776+ expect ( conf . options . path ) . toBe ( '/foo/tsconfig.bar.json' )
768777 expect ( findConfig ) . not . toBeCalled ( )
769778 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
770779 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -774,7 +783,7 @@ describe('readTsConfig', () => {
774783 )
775784 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
776785 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
777- expect ( conf . resolved . errors ) . toEqual ( [ ] )
786+ expect ( conf . errors ) . toEqual ( [ ] )
778787 } )
779788 } )
780789
@@ -790,13 +799,14 @@ describe('readTsConfig', () => {
790799 errors : [ ] ,
791800 } ) )
792801 } )
802+
793803 afterEach ( ( ) => {
794804 parseConfig . mockClear ( )
795805 } )
796806
797807 it ( 'should use correct paths when searching' , ( ) => {
798808 const conf = cs . readTsConfig ( )
799- expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
809+ expect ( conf . options . path ) . toBe ( '/root/tsconfig.json' )
800810 expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
801811 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
802812 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -806,13 +816,13 @@ describe('readTsConfig', () => {
806816 )
807817 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
808818 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
809- expect ( conf . resolved . errors ) . toEqual ( [ ] )
810- expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
819+ expect ( conf . errors ) . toEqual ( [ ] )
820+ expect ( conf . options . allowSyntheticDefaultImports ) . toEqual ( true )
811821 } )
812822
813823 it ( 'should use given tsconfig path' , ( ) => {
814824 const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
815- expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
825+ expect ( conf . options . path ) . toBe ( '/foo/tsconfig.bar.json' )
816826 expect ( findConfig ) . not . toBeCalled ( )
817827 expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
818828 expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
@@ -822,8 +832,8 @@ describe('readTsConfig', () => {
822832 )
823833 expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
824834 expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
825- expect ( conf . resolved . errors ) . toEqual ( [ ] )
826- expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
835+ expect ( conf . errors ) . toEqual ( [ ] )
836+ expect ( conf . options . allowSyntheticDefaultImports ) . toEqual ( true )
827837 } )
828838 } )
829839 } )
0 commit comments