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

test: use parallel mode by default #37

Merged
merged 1 commit into from
Feb 26, 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
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();
},
};
Loading