externalTests: Helper for neutralizing package locks

This commit is contained in:
Kamil Śliwak 2021-10-26 15:00:34 +02:00
parent b57c0a0b81
commit 7b7cc081db
4 changed files with 11 additions and 9 deletions

View File

@ -96,6 +96,14 @@ function replace_version_pragmas
find . test -name '*.sol' -type f -print0 | xargs -0 sed -i -E -e 's/pragma solidity [^;]+;/pragma solidity >=0.0;/'
}
function neutralize_package_lock
{
# Remove lock files (if they exist) to prevent them from overriding our changes in package.json
printLog "Removing package lock files..."
rm --force --verbose yarn.lock
rm --force --verbose package-lock.json
}
function force_truffle_solc_modules
{
local soljson="$1"

View File

@ -44,9 +44,7 @@ function ens_test
# Use latest Truffle. Older versions crash on the output from 0.8.0.
force_truffle_version ^5.1.55
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
rm -f package-lock.json
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"

View File

@ -45,9 +45,7 @@ function gnosis_safe_test
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7_080"|g' package.json
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
rm -f package-lock.json
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"

View File

@ -43,9 +43,7 @@ function gnosis_safe_test
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
rm -f package-lock.json
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"