Waffle
Waffle copied to clipboard
Incorrect behavior mockSmartContract if test running two and more files
Describe the bug
It seems like await mockContract.mock.<nameOfMethod>.returns(<value>)
doesn't work if test running two and more test files.
I'm using hardhat environment. I have a contractA
and mockContractB
. contractA
interacts with mockContractB
. I'm creating mockContractB
so:
const [deployer] = await ethers.getSigners();
const mockContractB = await deployMockContract(deployer, mockContractB_abi);
I'm executingawait mockContractB.mock.nameOfMethod.returns(value)
inside beforeEach
block. If I'm running test specify only one file, It works perfectly. But if I'm running test with the second test file, await mockContractB.mock.nameOfMethod.returns(value)
in the second test file has no effect. I tried exec await mockContractB.mock.nameOfMethod.returns(value)
in the it
block directly, but it had no effect again.
How does mockContrcat work with different test files? Is it okay behavior or not?
Software versions
-
ethereum-waffle
: ^3.4.4 - Package manager: npm
- Node version: 8.13.2
- Solidity version: 0.8.4
Hi @yanikitat, I've tried to reproduce this issue, but for me, everything seems to work fine. Do you still have this problem and if so can you please send me more details: version of Waffle you are using and maybe a minimal reproducible example?
Can't reproduce / Inactivity