Skip to content

Commit fd9f5a3

Browse files
agostbirofvictorio
andauthored
ci: test using local edr package for benchmark (#520)
Co-authored-by: Franco Victorio <[email protected]>
1 parent 5984f11 commit fd9f5a3

File tree

5 files changed

+149
-30
lines changed

5 files changed

+149
-30
lines changed

.github/workflows/edr-benchmark.yml

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ jobs:
5858
- name: Install package
5959
run: pnpm install --frozen-lockfile --prefer-offline
6060

61+
- name: Run benchmark tests
62+
run: pnpm test
63+
6164
- name: Run benchmark
6265
run: pnpm run -s benchmark
6366

crates/tools/js/benchmark/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99
"prebenchmark": "cd ../../../edr_napi/ && pnpm build",
1010
"verify": "node index.js verify",
1111
"report": "node index.js report",
12+
"test": "mocha --recursive \"test/**/*.js\"",
1213
"help": "node index.js -h"
1314
},
1415
"keywords": [],
1516
"author": "",
1617
"license": "ISC",
1718
"devDependencies": {
1819
"argparse": "^2.0.1",
20+
"chai": "^4.2.0",
1921
"hardhat": "2.22.5",
2022
"lodash": "^4.17.11",
23+
"mocha": "^10.0.0",
2124
"tsx": "^4.7.1"
2225
}
2326
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const { assert } = require("chai");
2+
const path = require("path");
3+
4+
// The benchmarks assume that the EDR version used by
5+
// Hardhat is the one in the workspace, instead of the one installed
6+
// from npm. This test checks that this is the case.
7+
it("uses the workspace version of EDR", async function () {
8+
const hardhatPath = require.resolve("hardhat");
9+
10+
const edrPath = require.resolve("@nomicfoundation/edr", {
11+
paths: [hardhatPath],
12+
});
13+
14+
const expectedPath = path.resolve(
15+
__dirname,
16+
"..",
17+
"..",
18+
"..",
19+
"..",
20+
"..",
21+
"crates",
22+
"edr_napi",
23+
"index.js",
24+
);
25+
26+
assert.equal(edrPath, expectedPath);
27+
});

hardhat-tests/integration/smock/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@defi-wonderland/smock": "^2.4.0",
1212
"@nomiclabs/hardhat-ethers": "^2.2.3",
1313
"chai": "^4.3.6",
14+
"ethers": "5",
1415
"hardhat": "2.22.5",
1516
"mocha": "^10.0.0"
1617
}

0 commit comments

Comments
 (0)