Skip to content

Commit 7b7cc08

Browse files
committed
externalTests: Helper for neutralizing package locks
1 parent b57c0a0 commit 7b7cc08

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

test/externalTests/common.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ function replace_version_pragmas
9696
find . test -name '*.sol' -type f -print0 | xargs -0 sed -i -E -e 's/pragma solidity [^;]+;/pragma solidity >=0.0;/'
9797
}
9898

99+
function neutralize_package_lock
100+
{
101+
# Remove lock files (if they exist) to prevent them from overriding our changes in package.json
102+
printLog "Removing package lock files..."
103+
rm --force --verbose yarn.lock
104+
rm --force --verbose package-lock.json
105+
}
106+
99107
function force_truffle_solc_modules
100108
{
101109
local soljson="$1"

test/externalTests/ens.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ function ens_test
4444
# Use latest Truffle. Older versions crash on the output from 0.8.0.
4545
force_truffle_version ^5.1.55
4646

47-
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
48-
rm -f package-lock.json
49-
47+
neutralize_package_lock
5048
replace_version_pragmas
5149
force_truffle_solc_modules "$SOLJSON"
5250
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"

test/externalTests/gnosis-v2.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ function gnosis_safe_test
4545
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
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

48-
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
49-
rm -f package-lock.json
50-
48+
neutralize_package_lock
5149
replace_version_pragmas
5250
force_truffle_solc_modules "$SOLJSON"
5351
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"

test/externalTests/gnosis.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ function gnosis_safe_test
4343

4444
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
4545

46-
# Remove the lock file (if it exists) to prevent it from overriding our changes in package.json
47-
rm -f package-lock.json
48-
46+
neutralize_package_lock
4947
replace_version_pragmas
5048
force_truffle_solc_modules "$SOLJSON"
5149
force_truffle_compiler_settings "$config_file" "${DIR}/solc" "$min_optimizer_level"

0 commit comments

Comments
 (0)