Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Remove the other slow Hardhat test #6114

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 1 addition & 69 deletions packages/dashboard-hardhat-plugin/test/hardhat.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { assert, expect } from "chai";
import { expect } from "chai";
import { it, describe, before, after } from "mocha";
import { TASK_COMPILE } from "hardhat/builtin-tasks/task-names";
import { HardhatError } from "hardhat/internal/core/errors";
import // IncompatibleHardhatBuildInfoFormatError,
// IncompatibleHardhatVersionError
"@truffle/from-hardhat";
import { resetHardhatContext } from "hardhat/plugins-testing";
import { useEnvironment } from "./helpers";
import fs from "fs";
import path from "path";

describe("Truffle dashboard hardhat plugin compilation tests", function () {
Expand All @@ -19,72 +17,6 @@ describe("Truffle dashboard hardhat plugin compilation tests", function () {
resetHardhatContext();
});

describe("Compiling with incompatible hardhat build info", function () {
useEnvironment("hardhat-project-incompatible", "dashboard");

it("should fail when incompatible hardhat build info (e.g. hh-sol-build-info-2) is detected", async function () {
this.timeout(20000);
await this.env.run(TASK_COMPILE, {
force: false,
quiet: false,
config: "hardhat.config.no.plugin.ts"
});

const buildInfoFiles = fs.readdirSync(
path.join(
__dirname,
"fixture-projects",
"hardhat-project-incompatible",
"artifacts",
"build-info"
)
);

const buildInfo = JSON.parse(
fs.readFileSync(
path.join(
__dirname,
"fixture-projects",
"hardhat-project-incompatible",
"artifacts",
"build-info",
buildInfoFiles[0]
),
"utf8"
)
);

buildInfo._format = "hh-sol-build-info-2";

fs.writeFileSync(
path.join(
__dirname,
"fixture-projects",
"hardhat-project-incompatible",
"artifacts",
"build-info",
buildInfoFiles[0]
),
JSON.stringify(buildInfo),
"utf8"
);

return await this.env
.run(TASK_COMPILE, { force: false, quiet: true })
.then(() => {
assert.fail("Compilation should fail.");
})
.catch(reason => {
// ideally should be checking for IncompatibleHardhatBuildInfoFormatError
// although there appear to be known issues with chai when subclassing built-in object (such as Error)
expect(reason).to.be.an.instanceOf(
Error,
'Error: Expected build-info to be one of ["hh-sol-build-info-1"], got: "hh-sol-build-info-2"'
);
});
});
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to delete the fixtures, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good point -- including the one for the other deleted test; I never deleted the fixtures for the other removed test either.

describe("Compiling when no valid Hardhat project", function () {
// manually loading the environment (below) to allow for the error thrown by the requiring of hh to be caught

Expand Down