It seems that when using the latest solidity-coverage (0.5.11), truffle (5.0.0-next.25) ganache-cli (6.2.4-beta.1) and solc (0.5.0) additional events / logs are emitted during tests which make the unit-tests fail.
My test code was like:
it('addSupplier', async () => {
// Act
const result = await contract.addSupplier(supplier1, 'Supplier 1');
// Assert
assert.lengthOf(result.logs, 1);
const log = result.logs[0];
assert.isNotNull(log);
const event = log.event;
assert.equal(event, 'AddSupplierEvent');
const eventArgs = log.args;
assert.isNotEmpty(eventArgs.from);
assert.isNotEmpty(eventArgs.id);
assert.equal(eventArgs.id, supplier1);
assert.equal(eventArgs.name, 'Supplier 1');
});
And I expected 1 event to be submitted : AddSupplierEvent
, however the output shows:
Events emitted during test:
[Coverage] ---------------------------
[Coverage]
[Coverage] __FunctionCoverageSupplyChainLogContract(fileName: C:/.../contracts/SupplyChainLogContract.sol, fnId: 1)
[Coverage] __CoverageSupplyChainLogContract(fileName: C:/.../contracts/SupplyChainLogContract.sol, lineNumber: 9)
[Coverage] __StatementCoverageSupplyChainLogContract(fileName: C:/.../contracts/SupplyChainLogContract.sol, statementId: 1)
...
[Coverage] AddSupplierEvent(from: 0xd721da73Adf6AfBFfaC15A8a4Bae662D5D02c351, id: 0x8caa8760a712e9E96868314Bc59711094BAB263E, name: Supplier 1)
Is this by design ?