Skip to content

Commit 8f80433

Browse files
committed
force_hardhat_unlimited_contract_size: Initialize 'hardhat' network if is not explicitly configured
1 parent e79a25e commit 8f80433

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/externalTests/common.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@ function force_hardhat_unlimited_contract_size
239239

240240
if [[ $config_file == *\.js ]]; then
241241
[[ $config_var_name == "" ]] || assertFail
242-
echo "module.exports.networks.hardhat.allowUnlimitedContractSize = true" >> "$config_file"
242+
echo "module.exports.networks.hardhat = module.exports.networks.hardhat || {allowUnlimitedContractSize: undefined}"
243+
echo "module.exports.networks.hardhat.allowUnlimitedContractSize = true"
243244
else
244245
[[ $config_file == *\.ts ]] || assertFail
245246
[[ $config_var_name != "" ]] || assertFail
246-
echo "${config_var_name}.networks!.hardhat!.allowUnlimitedContractSize = true" >> "$config_file"
247-
fi
247+
echo "${config_var_name}.networks!.hardhat ??= {allowUnlimitedContractSize: undefined};"
248+
echo "${config_var_name}.networks!.hardhat!.allowUnlimitedContractSize = true"
249+
fi >> "$config_file"
248250
}
249251

250252
function force_hardhat_compiler_settings

0 commit comments

Comments
 (0)