Running solidity-coverage gives the following error:

$npm run coverage
Writing artifacts to ./build/contracts

Launched testrpc on port 8555
Running: node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage ../tests/test0.js
(this can take a few seconds)...
Using network 'coverage'.

Error: ENOENT: no such file or directory, stat '/Users/solo/git/my-contract/coverageEnv/migrations'
Cleaning up...
Shutting down testrpc-sc (pid 5715)
Event trace could not be read.
Error: ENOENT: no such file or directory, open './allFiredEvents'
Exiting without generating coverage...
npm ERR! errno 1
npm ERR! my-contract@0.0.1 coverage: `solidity-coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-contract@0.0.1 coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/solo/.npm/_logs/2018-10-07T17_16_27_017Z-debug.log


module.exports = {
    copyPackages: ['zeppelin-solidity'],
    compileCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage',
    testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage ../tests/test0.js',
    port: '8555',
    skipFiles: []

truffle-config: ...

module.exports = {
  networks: {
    coverage: {
      host: 'localhost',
      network_id: '*', // eslint-disable-line camelcase
      port: 8555,
      gas: 0xfffffffffff,
      gasPrice: 0x01,

Running the testrpc and the test manually works just fine. But when running with solidity-coverage, for some reason it can't find the migrations dir in coverageEnv.

Any indication would be much appreciated. Thanks!


Although there might be a more elegant way to fix it, I managed to workaround this issue by copying the migrations scirpt as part of the testCommand: testCommand: 'cp -a ../migrations ../coverageEnv && node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage ../tests/test0.js',


Solidity-coverage creates a temporary directory based on your folder directory, I reccomend changing your test command to just be a path to your tests directory instead to a specific file.

Generally I use openzeppelin-solidity instead of zeppelin-solidity.

What is your file directory like?

  • Using a path to a single test is only used to isolate the issue. – scoriiu Oct 8 '18 at 13:14

In file .solcover.js:

  1. Change zeppelin-solidity to openzeppelin-solidity
  2. Change .bin/truffle to truffle/build/cli.bundled.js (2 occurrences)
  • Thanks for the tips, but they are not related to the issue. – scoriiu Oct 8 '18 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.