Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --parallel flag yarn test cmd #538

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -176,6 +178,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
Loading