In the official waffle documentation you may find the next way to implement fixtures:
import {expect} from 'chai';
import {loadFixture, deployContract} from 'ethereum-waffle';
import BasicTokenMock from './build/BasicTokenMock';
describe('Fixtures', () => {
async function fixture([wallet, other], provider) {
const token = await deployContract(wallet, BasicTokenMock, [
wallet.address, 1000
]);
return {token, wallet, other};
}
it('Assigns initial balance', async () => {
const {token, wallet} = await loadFixture(fixture);
expect(await token.balanceOf(wallet.address)).to.equal(1000);
});
it('Transfer adds amount to destination account', async () => {
const {token, other} = await loadFixture(fixture);
await token.transfer(other.address, 7);
expect(await token.balanceOf(other.address)).to.equal(7);
});
});
However, this won't work while using the plugin on hardhat. No official instructions were given on the plugin docs.
Answer below.