Skip to content

Commit

Permalink
test: run tests in parallel mode by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtamchik committed Feb 26, 2024
1 parent 516457d commit 062e26e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { globSync } from "glob";
import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from "hardhat/builtin-tasks/task-names";
import { HardhatUserConfig, subtask } from "hardhat/config";

import { mochaRootHooks } from "./test/setup";

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
solidity: {
Expand Down Expand Up @@ -75,6 +77,9 @@ const config: HardhatUserConfig = {
start: "echo Running tests...",
},
},
mocha: {
rootHooks: mochaRootHooks,
},
warnings: {
"@aragon/**/*": {
default: "off",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint:ts:fix": "pnpm lint:ts --fix",
"lint": "pnpm lint:sol && pnpm lint:ts",
"format": "prettier . --write --ignore-path .gitignore --ignore-path .prettierignore",
"test": "pnpm hardhat test",
"test": "pnpm hardhat test --parallel",
"test:coverage": "pnpm hardhat coverage",
"test:trace": "pnpm hardhat test --trace",
"watch:test": "pnpm hardhat watch test",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Assertion, expect, util } from "chai";

/**
* Custom Chai assertions along with types should be defined in this file.
* The file will be auto-included in the test suite by the chai setup, no need to import it.
*/
import { Assertion, expect, util } from "chai";

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down
12 changes: 12 additions & 0 deletions test/setup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Mocha from "mocha";

import "./assertion/revertedWithOZAccessControlError";

/**
* This is used to add custom assertions to the Chai assertion library in the test suite when it's run in parallel mode.
*/
export const mochaRootHooks = {
beforeEach(done: Mocha.Done) {
done();
},
};

0 comments on commit 062e26e

Please sign in to comment.