Skip to content

Commit

Permalink
feat: add --parallel flag yarn test cmd (#538)
Browse files Browse the repository at this point in the history
* feat: add --parallel flag yarn test cmd

* add the new package.json commands

---------

Co-authored-by: jordan <[email protected]>
  • Loading branch information
jordaniza and terrylovesyoghurt authored Feb 15, 2024
1 parent 8834c37 commit 1130dfc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ETHERSCAN_KEY=<Etherscan-Api-Key>
POLYGONSCAN_KEY=<Polygonscan-Api-Key>
ARBISCAN_KEY=<Arbiscan-Api-Key>

REPORT_GAS=<Report-Gas example: true>
COINMARKETCAP_API_KEY=<Coinmarketcap-Api-Key>

MAINNET_DAO_ENS_DOMAIN=<ENS-Domain example: dao.eth>
Expand Down
10 changes: 10 additions & 0 deletions packages/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix
```

> Tests can be sped up if needed. See [the test performance optimization](#performance-optimizations) section for more info.
## Documentation

You can find all documentation regarding how to use this protocol in [Aragon's Developer Portal here](https://devs.aragon.org).
Expand Down Expand Up @@ -177,6 +179,14 @@ describe('Legacy Test Example', function () {

# Performance optimizations

There are 3 ways to run tests:

1. `yarn test` runs tests in sequence. Can take a while but is the default.

2. `yarn test:parallel`, depending on your hardware can be significantly faster and is generally good for most cases. See the [hardhat docs](https://hardhat.org/hardhat-runner/docs/guides/test-contracts#running-tests-in-parallel) for more information about parallelized testing. Not suitable for gas reports (see below)

3. `yarn test:gas-report` outputs a gas report. Cannot be run in parallel mode.

For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable `TS_NODE_TRANSPILE_ONLY` to `1` in hardhat's environment. For more details see [the documentation](https://hardhat.org/guides/typescript.html#performance-optimizations).

# Releases
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const config: HardhatUserConfig = {
exclude: ['test'],
},
mocha: {
timeout: 60000, // 60 seconds // increase the timeout for subdomain validation tests
timeout: 90_000, // 90 seconds // increase the timeout for subdomain validation tests
},
};

Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"typechain:osx": "ts-node scripts/generate-typechain-osx.ts",
"typechain:osx-versions": "ts-node scripts/generate-typechain-osx-versions.ts",
"typechain": "yarn typechain:osx && yarn typechain:osx-versions",
"test:parallel": "hardhat test --parallel",
"test": "hardhat test",
"test:report-gas": "REPORT_GAS=true hardhat test",
"build": "hardhat compile && yarn typechain",
"build:npm": "rollup --config rollup.config.ts",
"coverage": "hardhat coverage --solcoverjs ./.solcover.js",
Expand Down

0 comments on commit 1130dfc

Please sign in to comment.