Skip to content

Commit

Permalink
add plugin to example project
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherDedominici committed Nov 21, 2024
1 parent 0080dec commit 80d5913
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions v-next/example-project/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import HardhatKeystore from "@ignored/hardhat-vnext-keystore";
import HardhatViem from "@ignored/hardhat-vnext-viem";
import hardhatNetworkHelpersPlugin from "@ignored/hardhat-vnext-network-helpers";
import hardhatEthersPlugin from "@ignored/hardhat-vnext-ethers";
import hardhatChaiMatchersPlugin from "@ignored/hardhat-vnext-chai-matchers";

util.inspect.defaultOptions.depth = null;

Expand Down Expand Up @@ -156,6 +157,7 @@ const config: HardhatUserConfig = {
hardhatNetworkHelpersPlugin,
HardhatNodeTestRunner,
HardhatViem,
hardhatChaiMatchersPlugin,
],
paths: {
tests: {
Expand Down
7 changes: 5 additions & 2 deletions v-next/example-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
},
"devDependencies": {
"@ignored/hardhat-vnext": "workspace:^3.0.0-next.16",
"@ignored/hardhat-vnext-chai-matchers": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-ethers": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-keystore": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-mocha-test-runner": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-network-helpers": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-node-test-runner": "workspace:^3.0.0-next.12",
"@ignored/hardhat-vnext-viem": "workspace:^3.0.0-next.11",
"@openzeppelin/contracts": "5.1.0",
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@types/node": "^20.14.9",
"chai": "^5.1.2",
"forge-std": "foundry-rs/forge-std#v1.9.4",
"mocha": "^10.0.0",
"prettier": "3.2.5",
"rimraf": "^5.0.5",
"typescript": "~5.5.0",
"viem": "^2.21.42",
"forge-std": "foundry-rs/forge-std#v1.9.4"
"viem": "^2.21.42"
}
}
16 changes: 16 additions & 0 deletions v-next/example-project/test/mocha/mocha-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import assert from "node:assert/strict";
import { describe, it } from "mocha";

import { expect } from "chai";

import { anyUint } from "@ignored/hardhat-vnext-chai-matchers/withArgs";
import { PANIC_CODES } from "@ignored/hardhat-vnext-chai-matchers/panic";

describe("Mocha test", () => {
it("should work", () => {
assert.equal(1 + 1, 2);
});
});

describe("Mocha test with chai-matchers", () => {
it("should import variables from the chai-matchers package", () => {
expect(anyUint).to.be.a("function");
expect(PANIC_CODES.ASSERTION_ERROR).to.be.a("number");
});

it("should have the hardhat additional matchers", () => {
expect("0x0000010AB").to.not.hexEqual("0x0010abc");
});
});
5 changes: 3 additions & 2 deletions v-next/hardhat-chai-matchers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"types": "dist/src/index.d.ts",
"exports": {
".": "./dist/src/index.js",
"./types": "./dist/src/types.js"
"./panic": "./dist/src/panic.js",
"./withArgs": "./dist/src/withArgs.js"
},
"keywords": [
"ethereum",
Expand All @@ -32,7 +33,7 @@
"test:coverage": "c8 --reporter html --reporter text --all --exclude test --exclude src/internal/types.ts --exclude src/internal/ui/direct-user-interruption-manager.ts --src src node --import tsx/esm --test --test-reporter=@ignored/hardhat-vnext-node-test-reporter \"test/!(fixture-projects|helpers)/**/*.ts\"",
"pretest": "pnpm build",
"pretest:only": "pnpm build",
"build": "tsc --build .",
"build": "tsc --build . && cp src/type-extensions.d.ts dist/src/type-extensions.d.ts",
"prepublishOnly": "pnpm build",
"clean": "rimraf dist"
},
Expand Down
2 changes: 2 additions & 0 deletions v-next/hardhat-chai-matchers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { HardhatPlugin } from "@ignored/hardhat-vnext/types/plugins";

import "./type-extensions.d.js";

const hardhatChaiMatchersPlugin: HardhatPlugin = {
id: "hardhat-chai-matchers",
hookHandlers: {
Expand Down
File renamed without changes.

0 comments on commit 80d5913

Please sign in to comment.