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.
@DimitarSD Hi. Have started looking at this but am having a difficult time. As a baseline:
$ git clone git clone https://github.com/LimeChain/etherlime.git # <-- master
$ cd etherlime
$ npm install
$ npm test
A bunch of tests relating to ganache fail.
$ npm i -g https://github.com/LimeChain/etherlime.git#etherlime-coverage
$ cd etherlime-example-test
$ etherlime test
Complains that it can't find etherlime (from the require statement in the LinkedList test). So then I also did:
$ npm init
$ npm install --save-dev https://github.com/LimeChain/etherlime.git#etherlime-coverage
and got a little further ... but I'm getting the same kind of errors I see in the etherlime repo tests - Error: invalid json response.
Would it be possible create a reproduction case for this issue that works out of the box? Ideally a sample project with all the necessary dependencies installed and some npm scripts that result in the error you've reported?
Would really like to get this working - from your issue description it seems like it's probably something small that can be easily fixed.
In order to use the etherlime commands, you should do npm link.
I wrote a simple shell script below which will do everything by itself. It will use its current directory as the start point.
red=`tput setaf 1`
reset=`tput sgr0`
echo โ${red}Creating etherlime testing folder...${reset}โ
mkdir etherlime-testing
cd etherlime-testing
echo โ${red}Cloning the etherlime repo...${reset}โ
git clone --depth 1 https://github.com/LimeChain/etherlime.git -b etherlime-coverage
cd etherlime
sudo npm install
echo โ${red}Linking the etherlime framework...${reset}โ
sudo npm link
cd ..
echo โ${red}Cloning the etherlime-example-test project...${reset}โ
git clone https://github.com/DimitarSD/etherlime-example-test.git
cd etherlime-example-test
echo โ${red}Installing npm modules${reset}โ
npm install
npm install --save [email protected]
npm install --save etherlime
echo โ${red}Running etherlime coverage command...${reset}โ
etherlime coverage
@DimitarSD Thanks so much, will check this out..
@DimitarSD Did you get this working? Saw a PR merge over there.
@cgewecke Yes, It is working now. I rewrote the unit tests we were using and suddenly all started working. Etherlime now has an integrated solidity-coverage inside via the etherlime coverage command ;)

@Perseverance Fantastic! Nice work.
Most helpful comment
@Perseverance Fantastic! Nice work.