Skip to content

Commit f93abe9

Browse files
authored
🐦 Test hardhat-waffle-plugin submodule (#810)
1 parent 0f7c496 commit f93abe9

File tree

12 files changed

+82
-178
lines changed

12 files changed

+82
-178
lines changed

.changeset/cyan-weeks-agree.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@ethereum-waffle/chai": patch
3+
"ethereum-waffle": patch
4+
---
5+
6+
Move call history injection logic to hardhat plugin

.github/workflows/CI-plugin.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Plugin CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
test-waffle-hardhat-plugin:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
hardhat: ['2.9.2', '2.11.2', 'latest']
13+
hardhat-ethers: ['2.0.3', '2.1.1', 'latest']
14+
hardhat-waffle: ['linked', 'latest']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 16.x
21+
22+
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
23+
- run: pnpm add -D hardhat@${{ matrix.hardhat }}
24+
working-directory: waffle-hardhat
25+
- run: pnpm add -D @nomiclabs/hardhat-ethers@${{ matrix.hardhat-ethers }}
26+
working-directory: waffle-hardhat
27+
- run: pnpm add -D @nomiclabs/hardhat-waffle@${{ matrix.hardhat-waffle }}
28+
if: ${{ matrix.hardhat-waffle != 'linked' }}
29+
working-directory: waffle-hardhat
30+
- name: Initialize plugin submodule
31+
if: ${{ matrix.hardhat-waffle == 'linked' }}
32+
run: |
33+
git submodule update --init
34+
cd hardhat-waffle-plugin
35+
yarn && yarn build
36+
- name: Use the submodule in our tests
37+
if: ${{ matrix.hardhat-waffle == 'linked' }}
38+
run: |
39+
rm -rf waffle-hardhat/node_modules/@nomiclabs/hardhat-waffle/dist
40+
cp -r hardhat-waffle-plugin/dist waffle-hardhat/node_modules/@nomiclabs/hardhat-waffle
41+
- run: pnpm run build
42+
- run: pnpm run test
43+
working-directory: waffle-hardhat

.github/workflows/CI.yml

-63
Original file line numberDiff line numberDiff line change
@@ -28,69 +28,6 @@ jobs:
2828
run: sudo cp ./.github/workflows/solc /bin
2929
- run: pnpm run build
3030
- run: pnpm run test
31-
test-hardhat-pre-244:
32-
runs-on: ubuntu-latest
33-
steps:
34-
- uses: actions/checkout@v2
35-
- name: Use Node.js
36-
uses: actions/setup-node@v1
37-
with:
38-
node-version: 16.x
39-
- run: npm i -g [email protected]
40-
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
41-
- name: setup-solc
42-
run: sudo cp ./.github/workflows/solc /bin
43-
- run: pnpm run build
44-
- name: Install versions of hardhat packages pre 2.4.4
45-
run: |
46-
47-
pnpm add -D @nomiclabs/[email protected]
48-
pnpm add -D @nomiclabs/[email protected]
49-
working-directory: waffle-hardhat
50-
- run: pnpm run test
51-
working-directory: waffle-hardhat
52-
test-hardhat-2112:
53-
runs-on: ubuntu-latest
54-
steps:
55-
- uses: actions/checkout@v2
56-
- name: Use Node.js
57-
uses: actions/setup-node@v1
58-
with:
59-
node-version: 16.x
60-
- run: npm i -g [email protected]
61-
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
62-
- name: setup-solc
63-
run: sudo cp ./.github/workflows/solc /bin
64-
- run: pnpm run build
65-
- name: Install latest versions of hardhat packages
66-
run: |
67-
68-
pnpm add -D @nomiclabs/[email protected]
69-
pnpm add -D @nomiclabs/[email protected]
70-
working-directory: waffle-hardhat
71-
- run: pnpm run test
72-
working-directory: waffle-hardhat
73-
test-hardhat-latest:
74-
runs-on: ubuntu-latest
75-
steps:
76-
- uses: actions/checkout@v2
77-
- name: Use Node.js
78-
uses: actions/setup-node@v1
79-
with:
80-
node-version: 16.x
81-
- run: npm i -g [email protected]
82-
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
83-
- name: setup-solc
84-
run: sudo cp ./.github/workflows/solc /bin
85-
- run: pnpm run build
86-
- name: Install latest versions of hardhat packages
87-
run: |
88-
pnpm add hardhat@latest
89-
pnpm add -D @nomiclabs/hardhat-waffle@latest
90-
pnpm add -D @nomiclabs/hardhat-ethers@latest
91-
working-directory: waffle-hardhat
92-
- run: pnpm run test
93-
working-directory: waffle-hardhat
9431
docs-and-linter:
9532
runs-on: ubuntu-latest
9633
env:

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "hardhat-waffle-plugin"]
2+
path = hardhat-waffle-plugin
3+
url = https://github.com/NomicFoundation/hardhat-waffle

hardhat-waffle-plugin

Submodule hardhat-waffle-plugin added at c5b5c29

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
"underscore": ">=1.12.1",
3939
"lodash": ">=4.17.21",
4040
"mixme": ">=0.5.1"
41-
}
41+
},
42+
"version": "0.0.0"
4243
}

pnpm-lock.yaml

+18-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waffle-chai/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {supportChangeTokenBalance} from './matchers/changeTokenBalance';
1515
import {supportChangeTokenBalances} from './matchers/changeTokenBalances';
1616
import {supportCalledOnContract} from './matchers/calledOnContract/calledOnContract';
1717
import {supportCalledOnContractWith} from './matchers/calledOnContract/calledOnContractWith';
18-
import './inject-call-history';
1918

2019
export function waffleChai(chai: Chai.ChaiStatic, utils: Chai.ChaiUtils) {
2120
supportBigNumber(chai.Assertion, utils);

waffle-chai/src/inject-call-history.ts

-78
This file was deleted.

waffle-hardhat/.mocharc.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
process.env.NODE_ENV = 'test'
2-
process.env.WAFFLE_EXPERIMENTAL_HARDHAT_CALL_HISTORY = true
32
module.exports = {
43
require: 'ts-node/register/transpile-only',
54
timeout: 50000,

waffle-hardhat/hardhat.config.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '@nomiclabs/hardhat-waffle'
1+
import 'hardhat-waffle-dev'
22

33
module.exports = {
44
networks: {
@@ -18,5 +18,8 @@ module.exports = {
1818
version: "0.8.10"
1919
}
2020
]
21-
}
21+
},
22+
waffle: {
23+
injectCallHistory: true
24+
}
2225
}

waffle-hardhat/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
},
2121
"devDependencies": {
2222
"@ethereum-waffle/chai": "workspace:*",
23+
"@ethereum-waffle/provider": "workspace:*",
2324
"@nomiclabs/hardhat-ethers": "2.1.0",
24-
"@nomiclabs/hardhat-waffle": "2.0.3",
25+
"hardhat-waffle-dev": "2.0.3-dev.c5b5c29",
2526
"@types/node": "^17.0.41",
2627
"eslint": "^7.14.0",
2728
"ethereum-waffle": "workspace:*",
28-
"mocha": "^8.2.1",
2929
"ethers": "5.6.2",
30-
"hardhat": "2.10.1"
30+
"hardhat": "2.10.1",
31+
"mocha": "^8.2.1"
3132
}
3233
}

0 commit comments

Comments
 (0)