Skip to content

Unable to integrate solidity-coverage to a framework. Receiving ''no such file or directory, open './allFiredEvents' error #276

@DimitarSD

Description

@DimitarSD

We're developing a tool called etherlime, which is basically an ethereum development and deployment framework based on ethers.js. We want to integrate solidity-coverage in it. However, we always get this error:

Event trace could not be read.
Error: ENOENT: no such file or directory, open './allFiredEvents'
Exiting without generating coverage...

In order to run the solidity-coverage I have created the following function

const runWithCoverage = async () => {
	var accountsData = ''
 	accounts.forEach(account => {
		let accountData = `--account "${account.secretKey},${account.balance.replace('0x', '')}" `;
		accountsData += accountData;
	});
	
	config["testrpcOptions"] = `${accountsData}`;
	const app = new App(config);
	app.generateCoverageEnvironment();
	app.instrumentTarget();
	app.launchTestrpc()
		.then(() => {
			app.runTestCommand();
			app.generateReport();
		})
		.catch(err => log(err));
}

The config variable contains the following object:

{
    "compileCommand": "etherlime compile --runs=999",
    "testCommand": "etherlime test",
    "copyPackages": ["zeppelin-solidity"],
    "port": 8545,
    "buildDirPath": "/build"
}

When the code is executed it uses by default testrpc-sc which comes from solidity-coverage. However, I keep getting the above error. Any ideas or advice will be very helpful.

Currently, the case can be tested using the etherlime with the etherlime-coverage branch here. There is a test project which can be used too.

Is it possible to integrate solidity-coverage in a framework like ours? The compilation process of the smart contracts in etherlime is based on truffle compile and the generated json files from our framework are the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions