Reputation: 31
I try to run solidity coverage for testing test case and its coverage but when I run coverage command its give error like this : - command used (truffle run coverage)
Using Truffle library from local node_modules.
solidity-coverage cleaning up, shutting down ganache server UnhandledRejections detected Promise { TypeError: Cannot read private member from an object whose class did not declare it at __classPrivateFieldGet (C:\Users\RahulMuwal\Downloads\smartcontract (2)\smartcontract\node_modules\truffle\node_modules\ganache\dist\node\webpack:\Ganache\core\lib\src\server.js:10:94)
Upvotes: 0
Views: 1341
Reputation: 159
Can confirm this is happening with brownie as well
The coverage command just hangs out and never ends lowering it to ganache 6 (ganache-cli) works
Mentioning this as I wasted many hours trying to figure this one out and hopefully this saves someone the misery
Upvotes: 0
Reputation: 627
solidity-coverage doesn't work well with ganache 7, which is packaged in latest Truffle 5.4.x.
To resolve:
yarn add -D [email protected]
(or npm install --save-dev [email protected]
)
Create a file called .solcover.js
in your working directory and add this content (or modify the existing content to include):
module.exports = {
client: require('ganache-cli'),
};
More info can be found here.
Upvotes: 0