euler: Override Hardhat test timeout

This commit is contained in:
Kamil Śliwak 2022-03-09 20:35:46 +01:00
parent bebdcccacd
commit 9ef600e572
2 changed files with 25 additions and 1 deletions

View File

@ -233,7 +233,6 @@ function force_truffle_compiler_settings
function name_hardhat_default_export
{
local config_file="$1"
local config_var_name="$2"
local import="import {HardhatUserConfig} from 'hardhat/types';"
local config="const config: HardhatUserConfig = {"
@ -241,6 +240,29 @@ function name_hardhat_default_export
echo "export default config;" >> "$config_file"
}
function force_hardhat_timeout
{
local config_file="$1"
local config_var_name="$2"
local new_timeout="$3"
printLog "Configuring Hardhat..."
echo "-------------------------------------"
echo "Timeout: ${new_timeout}"
echo "-------------------------------------"
if [[ $config_file == *\.js ]]; then
[[ $config_var_name == "" ]] || assertFail
echo "module.exports.mocha = module.exports.mocha || {timeout: ${new_timeout}}"
echo "module.exports.mocha.timeout = ${new_timeout}"
else
[[ $config_file == *\.ts ]] || assertFail
[[ $config_var_name != "" ]] || assertFail
echo "${config_var_name}.mocha = ${config_var_name}.mocha ?? {timeout: ${new_timeout}};"
echo "${config_var_name}.mocha!.timeout = ${new_timeout}"
fi >> "$config_file"
}
function force_hardhat_compiler_binary
{
local config_file="$1"

View File

@ -63,6 +63,8 @@ function euler_test
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")"
force_hardhat_unlimited_contract_size "$config_file"
# Workaround for the timeout that's too short for unoptimized code (https://github.com/ethereum/solidity/pull/12765)
force_hardhat_timeout "$config_file" "" 100000
npm install
replace_version_pragmas