[contracts] Tests now also work in Windows

This commit is contained in:
Mark Spanbroek 2022-03-21 11:37:47 +01:00 committed by markspanbroek
parent b8e013e439
commit 28294d431a
3 changed files with 12 additions and 14 deletions

View File

@ -174,6 +174,13 @@ jobs:
fi
make -j$ncpu ARCH_OVERRIDE=$PLATFORM CI_CACHE=NimBinaries QUICK_AND_DIRTY_COMPILER=1 update
- name: Start Ethereum Node with Dagger contracts
shell: bash
working-directory: nim-dagger/vendor/dagger-contracts
run: |
npm install
npm start &
- name: Run nim-dagger tests
shell: bash
working-directory: nim-dagger

View File

@ -34,22 +34,12 @@ proc test(name: string, srcDir = "tests/", params = "-d:chronicles_log_level=DEB
buildBinary name, srcDir, params
exec "build/" & name
task testContracts, "Build, deploy and test contracts":
exec "cd vendor/dagger-contracts && npm install"
# start node
exec "cd vendor/dagger-contracts && npm start &"
# run contract tests using deployed contracts
try:
test "testContracts", "tests/", "-d:chronicles_log_level=WARN"
finally:
# kill simulator processes
exec "ps -ef | grep hardhat | grep -v grep | awk '{ print $2 }' | xargs kill"
task testDagger, "Build & run Dagger tests":
test "testDagger", params = "-d:chronicles_log_level=WARN"
task testContracts, "Build & run Dagger Contract tests":
test "testContracts", "tests/", "-d:chronicles_log_level=WARN"
task test, "Run all tests":
testDaggerTask()
testContractsTask()

View File

@ -1,11 +1,12 @@
import std/json
import std/os
import pkg/ethers
import pkg/questionable
type Deployment* = object
json: JsonNode
const defaultFile = "vendor/dagger-contracts/deployment-localhost.json"
const defaultFile = "vendor" / "dagger-contracts" / "deployment-localhost.json"
## Reads deployment information from a json file. It expects a file that has
## been exported with Hardhat deploy.