@@ -841,6 +841,103 @@ describe("solidity plugin config validation", () => {
841841 ) ;
842842 } ) ;
843843 } ) ;
844+
845+ describe ( "splitTestsCompilation validation" , ( ) => {
846+ it ( "Should accept splitTestsCompilation: true in a single-version config" , ( ) => {
847+ assert . deepEqual (
848+ validateSolidityUserConfig ( {
849+ solidity : {
850+ version : "0.8.28" ,
851+ splitTestsCompilation : true ,
852+ } ,
853+ } ) ,
854+ [ ] ,
855+ ) ;
856+ } ) ;
857+
858+ it ( "Should accept splitTestsCompilation: false in a single-version config" , ( ) => {
859+ assert . deepEqual (
860+ validateSolidityUserConfig ( {
861+ solidity : {
862+ version : "0.8.28" ,
863+ splitTestsCompilation : false ,
864+ } ,
865+ } ) ,
866+ [ ] ,
867+ ) ;
868+ } ) ;
869+
870+ it ( "Should accept omitted splitTestsCompilation" , ( ) => {
871+ assert . deepEqual (
872+ validateSolidityUserConfig ( {
873+ solidity : {
874+ version : "0.8.28" ,
875+ } ,
876+ } ) ,
877+ [ ] ,
878+ ) ;
879+ } ) ;
880+
881+ it ( "Should reject invalid non-boolean splitTestsCompilation values" , ( ) => {
882+ assert . deepEqual (
883+ validateSolidityUserConfig ( {
884+ solidity : {
885+ version : "0.8.28" ,
886+ splitTestsCompilation : "yes" ,
887+ } as any ,
888+ } ) ,
889+ [
890+ {
891+ path : [ "solidity" , "splitTestsCompilation" ] ,
892+ message : "Expected boolean, received string" ,
893+ } ,
894+ ] ,
895+ ) ;
896+
897+ assert . deepEqual (
898+ validateSolidityUserConfig ( {
899+ solidity : {
900+ version : "0.8.28" ,
901+ splitTestsCompilation : 1 ,
902+ } as any ,
903+ } ) ,
904+ [
905+ {
906+ path : [ "solidity" , "splitTestsCompilation" ] ,
907+ message : "Expected boolean, received number" ,
908+ } ,
909+ ] ,
910+ ) ;
911+ } ) ;
912+
913+ it ( "Should accept splitTestsCompilation in a multi-version config" , ( ) => {
914+ assert . deepEqual (
915+ validateSolidityUserConfig ( {
916+ solidity : {
917+ compilers : [ { version : "0.8.28" } ] ,
918+ splitTestsCompilation : true ,
919+ } ,
920+ } ) ,
921+ [ ] ,
922+ ) ;
923+ } ) ;
924+
925+ it ( "Should accept splitTestsCompilation in a build-profiles config" , ( ) => {
926+ assert . deepEqual (
927+ validateSolidityUserConfig ( {
928+ solidity : {
929+ profiles : {
930+ default : {
931+ version : "0.8.28" ,
932+ } ,
933+ } ,
934+ splitTestsCompilation : true ,
935+ } ,
936+ } ) ,
937+ [ ] ,
938+ ) ;
939+ } ) ;
940+ } ) ;
844941} ) ;
845942
846943describe ( "solidity plugin config resolution" , ( ) => {
@@ -854,6 +951,78 @@ describe("solidity plugin config resolution", () => {
854951
855952 it . todo ( "should resolve a BuildProfilesSolidityUserConfig value" , ( ) => { } ) ;
856953
954+ describe ( "splitTestsCompilation resolution" , ( ) => {
955+ const otherResolvedConfig = { paths : { root : process . cwd ( ) } } as any ;
956+
957+ it ( "should default splitTestsCompilation to false for a string config" , async ( ) => {
958+ const resolvedConfig = await resolveSolidityUserConfig (
959+ { solidity : "0.8.28" } ,
960+ otherResolvedConfig ,
961+ ) ;
962+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , false ) ;
963+ } ) ;
964+
965+ it ( "should default splitTestsCompilation to false for a string-array config" , async ( ) => {
966+ const resolvedConfig = await resolveSolidityUserConfig (
967+ { solidity : [ "0.8.28" ] } ,
968+ otherResolvedConfig ,
969+ ) ;
970+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , false ) ;
971+ } ) ;
972+
973+ it ( "should default splitTestsCompilation to false when omitted from an object config" , async ( ) => {
974+ const resolvedConfig = await resolveSolidityUserConfig (
975+ { solidity : { version : "0.8.28" } } ,
976+ otherResolvedConfig ,
977+ ) ;
978+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , false ) ;
979+ } ) ;
980+
981+ it ( "should resolve splitTestsCompilation: true from a single-version config" , async ( ) => {
982+ const resolvedConfig = await resolveSolidityUserConfig (
983+ { solidity : { version : "0.8.28" , splitTestsCompilation : true } } ,
984+ otherResolvedConfig ,
985+ ) ;
986+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , true ) ;
987+ } ) ;
988+
989+ it ( "should resolve splitTestsCompilation: false from a single-version config" , async ( ) => {
990+ const resolvedConfig = await resolveSolidityUserConfig (
991+ { solidity : { version : "0.8.28" , splitTestsCompilation : false } } ,
992+ otherResolvedConfig ,
993+ ) ;
994+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , false ) ;
995+ } ) ;
996+
997+ it ( "should resolve splitTestsCompilation from a multi-version config" , async ( ) => {
998+ const resolvedConfig = await resolveSolidityUserConfig (
999+ {
1000+ solidity : {
1001+ compilers : [ { version : "0.8.28" } ] ,
1002+ splitTestsCompilation : true ,
1003+ } ,
1004+ } ,
1005+ otherResolvedConfig ,
1006+ ) ;
1007+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , true ) ;
1008+ } ) ;
1009+
1010+ it ( "should resolve splitTestsCompilation from a build-profiles config" , async ( ) => {
1011+ const resolvedConfig = await resolveSolidityUserConfig (
1012+ {
1013+ solidity : {
1014+ profiles : {
1015+ default : { version : "0.8.28" } ,
1016+ } ,
1017+ splitTestsCompilation : true ,
1018+ } ,
1019+ } ,
1020+ otherResolvedConfig ,
1021+ ) ;
1022+ assert . equal ( resolvedConfig . solidity . splitTestsCompilation , true ) ;
1023+ } ) ;
1024+ } ) ;
1025+
8571026 describe ( "profile-level preferWasm setting resolution" , function ( ) {
8581027 const otherResolvedConfig = { paths : { root : process . cwd ( ) } } as any ;
8591028
@@ -1595,6 +1764,7 @@ describe("validateResolvedConfig", () => {
15951764 profiles,
15961765 npmFilesToBuild : [ ] ,
15971766 registeredCompilerTypes,
1767+ splitTestsCompilation : false ,
15981768 } ,
15991769 } ) as unknown as HardhatConfig ;
16001770
0 commit comments