@@ -474,9 +474,8 @@ describe('typescript', () => {
474
474
createConfigSet ( { tsJestConfig : tsJest , parentConfig } ) . typescript
475
475
476
476
it ( 'should read file list from default tsconfig' , ( ) => {
477
- // since the default is to lookup for tsconfig,
478
- // we should have this file in the list
479
- expect ( get ( ) . fileNames ) . toContain ( normalizeSlashes ( __filename ) )
477
+ // since the default is to lookup for tsconfig, but we set include to [] so we should not have this file in the list
478
+ expect ( get ( ) . fileNames ) . toEqual ( [ ] )
480
479
} )
481
480
482
481
it . each ( [ 'tsConfig' , 'tsconfig' ] ) ( 'should include compiler config from `%s` option key' , ( key : string ) => {
@@ -614,6 +613,11 @@ describe('readTsConfig', () => {
614
613
const conf = cs . readTsConfig ( )
615
614
expect ( conf . input ) . toBeUndefined ( )
616
615
expect ( readConfig ) . not . toHaveBeenCalled ( )
616
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
617
+ expect . objectContaining ( {
618
+ include : [ ] ,
619
+ } ) ,
620
+ )
617
621
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
618
622
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBeUndefined ( )
619
623
} )
@@ -656,16 +660,27 @@ describe('readTsConfig', () => {
656
660
expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
657
661
expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
658
662
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
663
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
664
+ expect . objectContaining ( {
665
+ include : [ ] ,
666
+ } ) ,
667
+ )
659
668
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
660
669
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
661
670
expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
662
671
expect ( conf . resolved . errors ) . toMatchSnapshot ( )
663
672
} )
673
+
664
674
it ( 'should use given tsconfig path' , ( ) => {
665
675
const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
666
676
expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
667
677
expect ( findConfig ) . not . toBeCalled ( )
668
678
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
679
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
680
+ expect . objectContaining ( {
681
+ include : [ ] ,
682
+ } ) ,
683
+ )
669
684
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
670
685
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
671
686
expect ( conf . resolved . errors ) . toMatchSnapshot ( )
@@ -693,11 +708,17 @@ describe('readTsConfig', () => {
693
708
expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
694
709
expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
695
710
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
711
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
712
+ expect . objectContaining ( {
713
+ include : [ ] ,
714
+ } ) ,
715
+ )
696
716
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
697
717
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
698
718
expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
699
719
expect ( conf . resolved . errors ) . toMatchSnapshot ( )
700
720
} )
721
+
701
722
it ( 'should use given tsconfig path' , ( ) => {
702
723
const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
703
724
expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
@@ -730,16 +751,27 @@ describe('readTsConfig', () => {
730
751
expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
731
752
expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
732
753
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
754
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
755
+ expect . objectContaining ( {
756
+ include : [ ] ,
757
+ } ) ,
758
+ )
733
759
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
734
760
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
735
761
expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toBeUndefined ( )
736
762
expect ( conf . resolved . errors ) . toEqual ( [ ] )
737
763
} )
764
+
738
765
it ( 'should use given tsconfig path' , ( ) => {
739
766
const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
740
767
expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
741
768
expect ( findConfig ) . not . toBeCalled ( )
742
769
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
770
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
771
+ expect . objectContaining ( {
772
+ include : [ ] ,
773
+ } ) ,
774
+ )
743
775
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
744
776
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
745
777
expect ( conf . resolved . errors ) . toEqual ( [ ] )
@@ -767,16 +799,27 @@ describe('readTsConfig', () => {
767
799
expect ( conf . input . path ) . toBe ( '/root/tsconfig.json' )
768
800
expect ( findConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root' )
769
801
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/root/tsconfig.json' )
802
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
803
+ expect . objectContaining ( {
804
+ include : [ ] ,
805
+ } ) ,
806
+ )
770
807
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/root' )
771
808
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/root/tsconfig.json' )
772
809
expect ( conf . resolved . errors ) . toEqual ( [ ] )
773
810
expect ( conf . resolved . options . allowSyntheticDefaultImports ) . toEqual ( true )
774
811
} )
812
+
775
813
it ( 'should use given tsconfig path' , ( ) => {
776
814
const conf = cs . readTsConfig ( undefined , '/foo/tsconfig.bar.json' )
777
815
expect ( conf . input . path ) . toBe ( '/foo/tsconfig.bar.json' )
778
816
expect ( findConfig ) . not . toBeCalled ( )
779
817
expect ( readConfig . mock . calls [ 0 ] [ 0 ] ) . toBe ( '/foo/tsconfig.bar.json' )
818
+ expect ( parseConfig . mock . calls [ 0 ] [ 0 ] ) . toEqual (
819
+ expect . objectContaining ( {
820
+ include : [ ] ,
821
+ } ) ,
822
+ )
780
823
expect ( parseConfig . mock . calls [ 0 ] [ 2 ] ) . toBe ( '/foo' )
781
824
expect ( parseConfig . mock . calls [ 0 ] [ 4 ] ) . toBe ( '/foo/tsconfig.bar.json' )
782
825
expect ( conf . resolved . errors ) . toEqual ( [ ] )
@@ -878,7 +921,6 @@ describe('tsCompiler', () => {
878
921
it ( 'should be a compiler object' , ( ) => {
879
922
const cs = createConfigSet ( {
880
923
tsJestConfig : { tsConfig : false } as any ,
881
- jestConfig : { setupFiles : [ ] , setupFilesAfterEnv : [ ] } as any ,
882
924
} )
883
925
const compiler = cs . tsCompiler
884
926
expect ( compiler . cwd ) . toBe ( cs . cwd )
0 commit comments