token-vesting-contracts icon indicating copy to clipboard operation
token-vesting-contracts copied to clipboard

Error with yarn coverage

Open joelamouche opened this issue 1 year ago • 7 comments

Even after building with forge, I get these errors when running yarn coverage :

yarn run v1.22.10
$ npx hardhat coverage --solcoverjs ./.solcover.js

Version
=======
> solidity-coverage: v0.7.22

Instrumenting for coverage...
=============================

> MockTokenVesting.sol
> Token.sol
> TokenVesting.sol

Compilation:
============

Compiling 7 files with 0.8.19
ParserError: Source "solmate/tokens/ERC20.sol" not found: File not found. Searched the following locations: "".
 --> src/Token.sol:7:1:
  |
7 | import {ERC20} from "solmate/tokens/ERC20.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/tokens/ERC20.sol" not found: File not found. Searched the following locations: "".
 --> src/TokenVesting.sol:8:1:
  |
8 | import {ERC20} from "solmate/tokens/ERC20.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/auth/Owned.sol" not found: File not found. Searched the following locations: "".
 --> src/TokenVesting.sol:9:1:
  |
9 | import {Owned} from "solmate/auth/Owned.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/utils/SafeTransferLib.sol" not found: File not found. Searched the following locations: "".
  --> src/TokenVesting.sol:10:1:
   |
10 | import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/utils/ReentrancyGuard.sol" not found: File not found. Searched the following locations: "".
  --> src/TokenVesting.sol:11:1:
   |
11 | import {ReentrancyGuard} from "solmate/utils/ReentrancyGuard.sol";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Error in plugin solidity-coverage: HardhatError: HH600: Compilation failed

For more info run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

joelamouche avatar Apr 18 '23 15:04 joelamouche

once check version used in .sol files and package.json, must use same version.Fix to one version and develop projects :)

mujahid002 avatar Apr 18 '23 18:04 mujahid002

@mujahid002 the versions of what are you referring to please?

joelamouche avatar Apr 19 '23 08:04 joelamouche

@mujahid002 the versions of what are you referring to please?

I use ^0.8.6, try to use >=0.8.0 and while using any frameworks like truffle,hardhat once check solidity version in package.json

mujahid002 avatar Apr 19 '23 08:04 mujahid002

What package are you refering to when you say you use ^0.8.6 ?

joelamouche avatar Apr 19 '23 12:04 joelamouche

@mujahid002 I understand there is some discrepancy between package versions, but I'm having a bit of a struggle figuring out the correct configuration. Would you mind providing more information? Thanks.

GGAlanSmithee avatar Jul 23 '23 08:07 GGAlanSmithee

I have same error. How can fix it?

zerodev68 avatar Apr 15 '24 15:04 zerodev68

While importing packages please check it whether its correctly importing from node_modules!

For eg: import "../../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";

mujahid002 avatar Apr 16 '24 07:04 mujahid002