Skip to content

Commit c090ff9

Browse files
committed
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
1 parent 7b7cc08 commit c090ff9

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

test/externalTests/colony.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ function colony_test
4141
setup_solcjs "$DIR" "$SOLJSON"
4242
download_project "$repo" "$branch" "$DIR"
4343

44-
replace_version_pragmas
45-
force_truffle_solc_modules "$SOLJSON"
44+
neutralize_package_json_hooks
4645
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
4746
yarn
4847
git submodule update --init

test/externalTests/common.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ function neutralize_package_lock
104104
rm --force --verbose package-lock.json
105105
}
106106

107+
function neutralize_package_json_hooks
108+
{
109+
printLog "Disabling package.json hooks..."
110+
[[ -f package.json ]] || fail "package.json not found"
111+
sed -i 's|"prepublish": *".*"|"prepublish": ""|g' package.json
112+
sed -i 's|"prepare": *".*"|"prepare": ""|g' package.json
113+
}
114+
107115
function force_truffle_solc_modules
108116
{
109117
local soljson="$1"

test/externalTests/ens.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ function ens_test
4545
force_truffle_version ^5.1.55
4646

4747
neutralize_package_lock
48-
replace_version_pragmas
49-
force_truffle_solc_modules "$SOLJSON"
48+
neutralize_package_json_hooks
5049
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
5150
npm install
5251

test/externalTests/gnosis-v2.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ function gnosis_safe_test
4646
sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7_080"|g' package.json
4747

4848
neutralize_package_lock
49-
replace_version_pragmas
50-
force_truffle_solc_modules "$SOLJSON"
49+
neutralize_package_json_hooks
5150
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
5251
npm install --package-lock
5352

test/externalTests/gnosis.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ function gnosis_safe_test
4444
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
4545

4646
neutralize_package_lock
47-
replace_version_pragmas
48-
force_truffle_solc_modules "$SOLJSON"
47+
neutralize_package_json_hooks
4948
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
5049
npm install --package-lock
5150

test/externalTests/zeppelin.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ function zeppelin_test
4141
setup_solcjs "$DIR" "$SOLJSON"
4242
download_project "$repo" "$branch" "$DIR"
4343

44-
replace_version_pragmas
45-
force_truffle_solc_modules "$SOLJSON"
44+
neutralize_package_json_hooks
4645
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"
4746
npm install
4847

0 commit comments

Comments
 (0)