0

Getting compilation failed error, while running solidity-coverage. Truffle compile is working fine.

Here is my truffle config:

module.exports = {
  networks: {
    coverage: {
      host: '127.0.0.1',
      network_id: 5777,
      port: 8555,
      gas: 0xfffffffffff,
      gasPrice: 0x01
    },
  },
  compilers: {
    solc: {
      version: '0.5.10',
      settings: {
        optimizer: {
          enabled: true,
          runs: 200
        }
      }
    }
  },
  plugins: ["solidity-coverage"]
};

.solcover.js:

module.exports = {
  port: 8555,
  norpc: true,
  deepSkip: true,
  compileCommand: '../node_modules/.bin/truffle compile',
  testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
  skipFiles: [
    'imports',
    'EventCaller.sol',
    'dummyDaiFeed.sol',
    'mocks'
  ],
  forceParse: [
    'imports/ERC1132',
    'mocks'
  ]
};

Command used to run coverage: node_modules/.bin/solidity-coverage

Getting this error only while running coverage:

* Line 1, Column 1
  Syntax error: value, object or array expected.
* Line 1, Column 2
  Extra non-whitespace after JSON value.
Compilation failed. See above.

Error occurred during the compilation after the instrumentation was completed.

0

Change this:

compileCommand: '../node_modules/.bin/truffle compile',
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',

To this:

compileCommand: 'node ../node_modules/truffle/build/cli.bundled.js compile --network=coverage',
testCommand: 'node --max-old-space-size=4096 ../node_modules/truffle/build/cli.bundled.js test --network=coverage',
| improve this answer | |
  • Thanks for the answer. Tried changing, still getting same error – Dushyanth Kumar Reddy Jan 31 at 6:30
0

Updated .solcover.js As per the gitter conversation in solidity-coverage channel, i got to know that there is some error while instrumention oraclize contract. So added the 'external' folder to skipFiles, in which oraclize contract is residing.

module.exports = {
  skipFiles: ['external', 'EventCaller.sol', 'dummyDaiFeed.sol', 'mocks'],
  providerOptions: {
    default_balance_ether: 10000000000, // Extra zero, coverage consumes more gas
    network_id: 5777,
    mnemonic:
      'grocery obvious wire insane limit weather parade parrot patrol stock blast ivory',
    total_accounts: 30
  }
};

And now coverage tool is working fine.

| improve this answer | |

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.