externalTests: Neutralize npm hooks instead of replacing pragmas twice

- This also has the nice effect of stopping projects from trying to compile contracts during installation
This commit is contained in:
Kamil Śliwak 2021-10-26 15:39:19 +02:00
parent 7b7cc081db
commit c090ff9d83
6 changed files with 13 additions and 10 deletions

View File

@ -41,8 +41,7 @@ function colony_test
setup_solcjs "$DIR" "$SOLJSON"
download_project "$repo" "$branch" "$DIR"
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
yarn
git submodule update --init

View File

@ -104,6 +104,14 @@ function neutralize_package_lock
rm --force --verbose package-lock.json
}
function neutralize_package_json_hooks
{
printLog "Disabling package.json hooks..."
[[ -f package.json ]] || fail "package.json not found"
sed -i 's|"prepublish": *".*"|"prepublish": ""|g' package.json
sed -i 's|"prepare": *".*"|"prepare": ""|g' package.json
}
function force_truffle_solc_modules
{
local soljson="$1"

View File

@ -45,8 +45,7 @@ function ens_test
force_truffle_version ^5.1.55
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
npm install

View File

@ -46,8 +46,7 @@ function gnosis_safe_test
sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7_080"|g' package.json
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
npm install --package-lock

View File

@ -44,8 +44,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
neutralize_package_lock
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
npm install --package-lock

View File

@ -41,8 +41,7 @@ function zeppelin_test
setup_solcjs "$DIR" "$SOLJSON"
download_project "$repo" "$branch" "$DIR"
replace_version_pragmas
force_truffle_solc_modules "$SOLJSON"
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
npm install