hardhat
hardhat copied to clipboard
`test` task and pre-compile issue
Reproduction steps:
git clone https://github.com/fvictorio/nexusmutual- Install dependencies and run tests twice.
- Notice that the error message is different the second time
Another way of doing this is running hh clean && hh test vs hh clean && hh compile && hh test
The reason might be related to this:
task('test', async (_, hre, runSuper) => {
hre.accounts = await hre.web3.eth.getAccounts();
const testFiles = _.testFiles.length ? _.testFiles : ['./test/index.js'];
await runSuper({ testFiles });
});
Output logs for the two tests runs are included next.
First run
Nexus Mutual UNIT TESTS TokenController removeEmptyReason 1) reverts when index is out of bounds
0 passing (357ms) 1 failing
- Nexus Mutual
UNIT TESTS
TokenController
removeEmptyReason
reverts when index is out of bounds:
Error: Transaction reverted without a reason string
at <UnrecognizedContract>.
(0x5fc8d32690cc91d4c39d9d3abcbd16989f875707) at TruffleContract.removeEmptyReason (node_modules/@nomiclabs/truffle-contract/lib/execute.js:169:26) at Context. (test/unit/TokenController/removeEmptyReason.js:39:27) at processTicksAndRejections (internal/process/task_queues.js:93:5)
Second run
Nexus Mutual UNIT TESTS TokenController removeEmptyReason 1) reverts when index is out of bounds
0 passing (369ms) 1 failing
- Nexus Mutual
UNIT TESTS
TokenController
removeEmptyReason
reverts when index is out of bounds:
Error: VM Exception while processing transaction: invalid opcode
at TokenController._removeEmptyReason (contracts/modules/token/TokenController.sol:658)
at TokenController.removeEmptyReason (contracts/modules/token/TokenController.sol:636)
at TruffleContract.removeEmptyReason (node_modules/@nomiclabs/truffle-contract/lib/execute.js:169:26)
at Context.
(test/unit/TokenController/removeEmptyReason.js:39:27) at processTicksAndRejections (internal/process/task_queues.js:93:5)
@sisco0 you've seem to have fixed something in the reproduction example, but the problem has to be in Hardhat: even if the test is wrong, the fact that the results are inconsistent (in one scenario de test case passes but in the other it doesn't) suggest that there might be a bug on Hardhat's side.
This error is the same one that I mentioned as (1) here, and I've already fixed it. I'll submit a PR tomorrow.
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Fixed via #2218