diff --git a/packages/hardhat-core/test/builtin-tasks/test.ts b/packages/hardhat-core/test/builtin-tasks/test.ts index 39bc884564..bc21f8477a 100644 --- a/packages/hardhat-core/test/builtin-tasks/test.ts +++ b/packages/hardhat-core/test/builtin-tasks/test.ts @@ -38,7 +38,7 @@ describe("test task", function () { describe("with the default config", function () { useEnvironment(); - it("should fail in serial mode because the HRE is shared between test files", async function () { + it("should fail in serial mode", async function () { await this.env.run("test", { noCompile: true, }); @@ -47,7 +47,7 @@ describe("test task", function () { (process as any).exitCode = undefined; }); - it("should pass in parallel mode because the HRE is not shared between test files", async function () { + it("should pass in parallel mode", async function () { await this.env.run("test", { noCompile: true, parallel: true, diff --git a/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/check-parallel.js b/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/check-parallel.js new file mode 100644 index 0000000000..bd07fe7176 --- /dev/null +++ b/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/check-parallel.js @@ -0,0 +1,7 @@ +const assert = require("assert"); + +describe("parallel tests", function () { + it("pass if run in parallel mode", async function () { + assert(process.env.MOCHA_WORKER_ID !== undefined); + }); +}); diff --git a/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test1.js b/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test1.js deleted file mode 100644 index b2e75b83ab..0000000000 --- a/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test1.js +++ /dev/null @@ -1,18 +0,0 @@ -const assert = require("assert"); - -describe("test suite 1", function () { - it("should start with block number 0", async function () { - const blockNumber = await network.provider.send("eth_blockNumber"); - - assert(blockNumber === "0x0"); - - // send a tx to increase the block number - const [a] = await network.provider.send("eth_accounts"); - await network.provider.send("eth_sendTransaction", [ - { - from: a, - to: a, - }, - ]); - }); -}); diff --git a/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test2.js b/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test2.js deleted file mode 100644 index 126428887d..0000000000 --- a/packages/hardhat-core/test/fixture-projects/test-task/parallel-tests/test/test2.js +++ /dev/null @@ -1,18 +0,0 @@ -const assert = require("assert"); - -describe("test suite 2", function () { - it("should start with block number 0", async function () { - const blockNumber = await network.provider.send("eth_blockNumber"); - - assert(blockNumber === "0x0"); - - // send a tx to increase the block number - const [a] = await network.provider.send("eth_accounts"); - await network.provider.send("eth_sendTransaction", [ - { - from: a, - to: a, - }, - ]); - }); -});