@nomicfoundation/hardhat-ethers-chai-matchers 3.0.0-next.26 → 3.0.0-next.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -26
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -1,31 +1,24 @@
1
- # Hardhat Ethers Chai Matchers plugin
1
+ # hardhat-ethers-chai-matchers
2
2
 
3
3
  This plugin adds Ethereum-specific matchers to the [Chai](https://chaijs.com/) assertion library that integrate with [ethers.js](https://ethers.org/), making your smart contract tests easy to write and read.
4
4
 
5
5
  ## Installation
6
6
 
7
+ > This plugin is part of the [Ethers+Mocha Hardhat Toolbox](/v-next/hardhat-toolbox-mocha-ethers/). If you are using that toolbox, there's nothing else you need to do.
8
+
7
9
  To install this plugin, run the following command:
8
10
 
9
11
  ```bash
10
- npm install --save-dev @nomicfoundation/hardhat-ethers-chai-matchers@next
12
+ npm install --save-dev @nomicfoundation/hardhat-ethers-chai-matchers
11
13
  ```
12
14
 
13
- and add the following statements to your `hardhat.config.ts` file:
14
-
15
- ```typescript
16
- // ...
17
- import ethersChaiMatchersPlugin from "@nomicfoundation/hardhat-ethers-chai-matchers";
15
+ In your `hardhat.config.ts` file, import the plugin and add it to the `plugins` array:
18
16
 
19
- // ...
17
+ ```ts
18
+ import hardhatEthersChaiMatchers from "@nomicfoundation/hardhat-ethers-chai-matchers";
20
19
 
21
20
  export default {
22
- // ...
23
- plugins: [
24
- // ...
25
- ethersChaiMatchersPlugin,
26
- ],
27
-
28
- // ...
21
+ plugins: [hardhatEthersChaiMatchers],
29
22
  };
30
23
  ```
31
24
 
@@ -33,20 +26,16 @@ export default {
33
26
 
34
27
  You don't need to do anything else to use this plugin. Whenever you run your tests with Hardhat, it will automatically add the matchers.
35
28
 
36
- Here is an example of using the `changeEtherBalances` matcher:
29
+ Here is an example of using the `emit` matcher:
37
30
 
38
31
  ```ts
39
32
  import { expect } from "chai";
40
33
 
41
- // ...
42
- // ...
43
-
44
- const amount = ethers.utils.parseEther("1");
34
+ it("some test", async function () {
35
+ const contract = await ethers.deployContract("SomeContract");
45
36
 
46
- await expect(() =>
47
- sender.sendTransaction({
48
- to: contract,
49
- value: AMOUNT,
50
- }),
51
- ).to.changeEtherBalances(provider, [sender, contract], [-AMOUNT, AMOUNT]);
37
+ await expect(contract.someFunction())
38
+ .to.emit(contract, "SomeEvent")
39
+ .withArgs("0x...", 3);
40
+ });
52
41
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomicfoundation/hardhat-ethers-chai-matchers",
3
- "version": "3.0.0-next.26",
3
+ "version": "3.0.0-next.27",
4
4
  "description": "Hardhat utils for testing",
5
5
  "homepage": "https://github.com/nomicfoundation/hardhat/tree/v-next/v-next/hardhat-ethers-chai-matchers",
6
6
  "repository": {
@@ -31,8 +31,8 @@
31
31
  "README.md"
32
32
  ],
33
33
  "devDependencies": {
34
- "@nomicfoundation/hardhat-mocha": "^3.0.0-next.26",
35
- "@nomicfoundation/hardhat-node-test-reporter": "^3.0.0-next.26",
34
+ "@nomicfoundation/hardhat-mocha": "^3.0.0-next.27",
35
+ "@nomicfoundation/hardhat-node-test-reporter": "^3.0.0-next.27",
36
36
  "@types/chai": "^4.2.0",
37
37
  "@types/debug": "^4.1.7",
38
38
  "@types/deep-eql": "^4.0.2",
@@ -46,18 +46,18 @@
46
46
  "rimraf": "^5.0.5",
47
47
  "tsx": "^4.19.3",
48
48
  "typescript": "~5.8.0",
49
- "@nomicfoundation/hardhat-test-utils": "^3.0.0-next.26"
49
+ "@nomicfoundation/hardhat-test-utils": "^3.0.0-next.27"
50
50
  },
51
51
  "dependencies": {
52
- "@nomicfoundation/hardhat-errors": "^3.0.0-next.26",
53
- "@nomicfoundation/hardhat-utils": "^3.0.0-next.26",
52
+ "@nomicfoundation/hardhat-errors": "^3.0.0-next.27",
53
+ "@nomicfoundation/hardhat-utils": "^3.0.0-next.27",
54
54
  "@types/chai-as-promised": "^8.0.1",
55
55
  "chai-as-promised": "^8.0.0",
56
56
  "deep-eql": "^5.0.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "hardhat": "^3.0.0-next.26",
60
- "@nomicfoundation/hardhat-ethers": "^4.0.0-next.26",
59
+ "hardhat": "^3.0.0-next.27",
60
+ "@nomicfoundation/hardhat-ethers": "^4.0.0-next.27",
61
61
  "chai": "^5.1.2",
62
62
  "ethers": "^6.14.0"
63
63
  },