ganache-cli supports a fork parameter, -k, which lets you specify which network upgrade to test with. It would be useful if there was a way to pass this information to the ganache. Perhaps a setting in .solcover.js?
@wjmelements
I think if you want to test vs. istanbul you will need to upgrade to the 0.7.0 beta.
That lets you use any ganache version and specify providerOptions for it in .solcover.js. The options format follows ganache-core. In that context -k is called hardfork.
(There's an upgrade guide from 0.6.x if you're interested, here)
Please just lmk if you have any difficulty with this...
I'll do this Monday as part of TrustToken/registry#22
Thanks, I'll let you know how it goes.
I got it working. Here were the steps.
I installed the beta solidity-coverage and added the plugin line to truffle.js:
plugins: ["solidity-coverage"],
When I set
providerOptions: {
"hardfork": "istanbul"
}
I get
Error: Hardfork istanbul not set as supported in supportedHardforks
So I install ganache-cli locally as:
"ganache-cli": "6.8.0-istanbul.0",
and set in .solcover.js
client: require('ganache-cli'),
I hope this will help others work through getting Istanbul working.
Thanks @cgewecke
Line coverage does not seem to work, though.
@wjmelements Sorry, could you elaborate on line coverage not working?
@wjmelements There's an issue in your project with how solc is configured in truffle.js. For internal reasons, solidity-coverage modifies the solc settings to compile without optimization, and assumes the Truffle V5 convention for that option.
TLDR; removing the Truffle V4 style config:
/*solc: {
version: "0.5.13",
evmVersion: "istanbul",
optimizer: {
enabled: true,
runs: 20000
}
},*/
compilers: {
solc: {
version: "0.5.13",
evmVersion: "istanbul",
optimizer: {
enabled: true,
runs: 20000
}
},
},
... will give you this:

Wow, thanks!
On Mon, Nov 18, 2019 at 7:12 PM cgewecke notifications@github.com wrote:
@wjmelements https://github.com/wjmelements There's an issue in your
project with how solc is configured in truffle.js. For internal reasons,
solidity-coverage modifies the solc settings to compile without
optimization, and assumes the Truffle V5 convention for that option.TLDR; removing the Truffle V4 style config:
/solc: { version: "0.5.13", evmVersion: "istanbul", optimizer: { enabled: true, runs: 20000 }},/
compilers: {
solc: {
version: "0.5.13",
evmVersion: "istanbul",
optimizer: {
enabled: true,
runs: 20000
}
},
},... will give you this:
[image: Screen Shot 2019-11-18 at 7 04 46 PM]
https://user-images.githubusercontent.com/7332026/69113134-f4375480-0a36-11ea-95ae-36c68e1c2aac.png—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/sc-forks/solidity-coverage/issues/431?email_source=notifications&email_token=AAGDGVMDKNI2CRCHVPDKQYTQUNKS5A5CNFSM4JOC5CYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEMWNUA#issuecomment-555312848,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAGDGVIR7P5JNHDUH6IT2V3QUNKS5ANCNFSM4JOC5CYA
.
Most helpful comment
I got it working. Here were the steps.
I installed the beta solidity-coverage and added the plugin line to truffle.js:
When I set
I get
So I install
ganache-clilocally as:and set in
.solcover.jsI hope this will help others work through getting Istanbul working.
Thanks @cgewecke