@@ -872,6 +872,15 @@ describe('WebpackConfig object', () => {
872872 config . enableTypeScriptLoader ( 'FOO' ) ;
873873 } ) . to . throw ( 'must be a callback function' ) ;
874874 } ) ;
875+
876+ it ( 'TypeScript can not be compiled by ts-loader is Babel is already handling TypeScript' , ( ) => {
877+ const config = createConfig ( ) ;
878+ config . enableBabelTypeScriptPreset ( ) ;
879+
880+ expect ( function ( ) {
881+ config . enableTypeScriptLoader ( ) ;
882+ } ) . to . throw ( 'Encore.enableTypeScriptLoader() can not be called when Encore.enableBabelTypeScriptPreset() has been called.' ) ;
883+ } ) ;
875884 } ) ;
876885
877886 describe ( 'enableForkedTypeScriptTypesChecking' , ( ) => {
@@ -891,8 +900,37 @@ describe('WebpackConfig object', () => {
891900 config . enableForkedTypeScriptTypesChecking ( 'FOO' ) ;
892901 } ) . to . throw ( 'must be a callback function' ) ;
893902 } ) ;
903+
904+ it ( 'TypeScript can not be compiled by Babel if forked types checking is enabled' , ( ) => {
905+ const config = createConfig ( ) ;
906+ config . enableForkedTypeScriptTypesChecking ( ) ;
907+
908+ expect ( function ( ) {
909+ config . enableBabelTypeScriptPreset ( ) ;
910+ } ) . to . throw ( 'Encore.enableBabelTypeScriptPreset() can not be called when Encore.enableForkedTypeScriptTypesChecking() has been called.' ) ;
911+ } ) ;
894912 } ) ;
895913
914+ describe ( 'enableBabelTypeScriptPreset' , ( ) => {
915+ it ( 'TypeScript can not be compiled by Babel if ts-loader is already enabled' , ( ) => {
916+ const config = createConfig ( ) ;
917+ config . enableTypeScriptLoader ( ) ;
918+
919+ expect ( function ( ) {
920+ config . enableBabelTypeScriptPreset ( ) ;
921+ } ) . to . throw ( 'Encore.enableBabelTypeScriptPreset() can not be called when Encore.enableTypeScriptLoader() has been called.' ) ;
922+ } ) ;
923+
924+ it ( 'TypeScript can not be compiled by Babel if ts-loader is already enabled' , ( ) => {
925+ const config = createConfig ( ) ;
926+ config . enableForkedTypeScriptTypesChecking ( ) ;
927+
928+ expect ( function ( ) {
929+ config . enableBabelTypeScriptPreset ( ) ;
930+ } ) . to . throw ( 'Encore.enableBabelTypeScriptPreset() can not be called when Encore.enableForkedTypeScriptTypesChecking() has been called.' ) ;
931+ } ) ;
932+ } )
933+
896934 describe ( 'enableVueLoader' , ( ) => {
897935 it ( 'Call with no config' , ( ) => {
898936 const config = createConfig ( ) ;
0 commit comments