Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sc-forks/solidity-coverage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d9d8ecd27b48c55feaf9d14246e2fba0cf27e86c
Choose a base ref
...
head repository: sc-forks/solidity-coverage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0a33e13b166651bf8ce94d425d0abf590fed784c
Choose a head ref
Loading
Showing with 6,811 additions and 501,795 deletions.
  1. +5 −26 .circleci/config.yml
  2. +0 −133 BUIDLER_README.md
  3. +21 −0 CHANGELOG.md
  4. +31 −46 README.md
  5. +25 −1 docs/advanced.md
  6. +9 −47 docs/faq.md
  7. +421 −0 docs/matrix.md
  8. +0 −138 docs/upgrade.md
  9. +99 −0 lib/abi.js
  10. +73 −2 lib/api.js
  11. +5 −7 lib/collector.js
  12. +7 −2 lib/coverage.js
  13. +226 −14 lib/injector.js
  14. +18 −6 lib/instrumenter.js
  15. +70 −14 lib/parse.js
  16. +247 −7 lib/registrar.js
  17. +0 −185 lib/ternary/conditional.js
  18. +0 −121 lib/ternary/ternary.js
  19. +2 −2 lib/ui.js
  20. +12 −2 lib/validator.js
  21. +14 −17 package.json
  22. +0 −148 plugins/buidler.plugin.js
  23. +41 −10 plugins/hardhat.plugin.js
  24. +1 −6 plugins/nomiclabs.plugin.js
  25. +145 −0 plugins/resources/matrix.js
  26. +6 −2 plugins/resources/nomiclabs.ui.js
  27. +51 −1 plugins/resources/nomiclabs.utils.js
  28. +66 −0 plugins/resources/plugin.ui.js
  29. +1 −1 plugins/resources/plugin.utils.js
  30. +0 −493,393 plugins/resources/truffle.library.js
  31. +0 −1 plugins/resources/truffle.library.js.map
  32. +0 −107 plugins/resources/truffle.ui.js
  33. +0 −217 plugins/resources/truffle.utils.js
  34. +0 −127 plugins/truffle.plugin.js
  35. +0 −25 scripts/run-colony.sh
  36. +0 −55 scripts/run-metacoin.sh
  37. +13 −19 scripts/run-nomiclabs.sh
  38. +3 −0 scripts/run-zeppelin.sh
  39. +1 −1 test/integration/generic/assets/SimpleError.sol
  40. +1 −1 test/integration/generic/contracts/Migrations.sol
  41. +0 −7 test/integration/projects/bad-solcoverjs/truffle-config.js
  42. +1 −2 test/integration/projects/contract-subfolders/contracts/A/ContractA2.sol
  43. +1 −1 test/integration/projects/contract-subfolders/contracts/B/ContractB2.sol
  44. +1 −1 test/integration/projects/contract-subfolders/hardhat.config.js
  45. +0 −7 test/integration/projects/contract-subfolders/truffle-config.js
  46. +1 −1 test/integration/projects/ganache-solcoverjs/contracts/ContractA.sol
  47. +1 −1 test/integration/projects/ganache-solcoverjs/contracts/ContractB.sol
  48. +1 −1 test/integration/projects/ganache-solcoverjs/contracts/ContractC.sol
  49. +1 −1 test/integration/projects/ganache-solcoverjs/hardhat.config.js
  50. +0 −7 test/integration/projects/ganache-solcoverjs/truffle-config.js
  51. +1 −1 test/integration/projects/hardhat-compile-config/contracts/ContractA1.sol
  52. +1 −1 test/integration/projects/hardhat-gas-reporter/contracts/ContractA.sol
  53. +1 −1 test/integration/projects/hardhat-gas-reporter/hardhat.config.js
  54. +1 −1 test/integration/projects/import-paths/assets/RelativePathImport.sol
  55. +0 −23 test/integration/projects/import-paths/contracts/Migrations.sol
  56. +1 −1 test/integration/projects/import-paths/contracts/OnlyUsesImports.sol
  57. +1 −1 test/integration/projects/import-paths/contracts/UsesImports.sol
  58. +1 −1 test/integration/projects/import-paths/hardhat.config.js
  59. +0 −5 test/integration/projects/import-paths/migrations/1_initial_migration.js
  60. +1 −1 test/integration/projects/import-paths/node_modules/package/AnotherImport.sol
  61. +1 −1 test/integration/projects/import-paths/node_modules/package/NodeModulesImport.sol
  62. +0 −7 test/integration/projects/import-paths/truffle-config.js
  63. +1 −1 test/integration/projects/libraries/contracts/CLibrary.sol
  64. +1 −1 test/integration/projects/libraries/contracts/Migrations.sol
  65. +1 −5 test/integration/projects/libraries/contracts/PureView.sol
  66. +3 −3 test/integration/projects/libraries/contracts/UsesPure.sol
  67. +1 −1 test/integration/projects/libraries/contracts/_Interface.sol
  68. +1 −1 test/integration/projects/libraries/hardhat.config.js
  69. +0 −7 test/integration/projects/libraries/truffle-config.js
  70. +17 −0 test/integration/projects/matrix/.solcover.js
  71. +6 −2 ...integration/projects/{multiple-migrations/contracts/ContractB.sol → matrix/contracts/MatrixA.sol}
  72. +2 −2 ...integration/projects/{multiple-migrations/contracts/ContractA.sol → matrix/contracts/MatrixB.sol}
  73. +99 −0 test/integration/projects/matrix/expectedMochaOutput.json
  74. +48 −0 test/integration/projects/matrix/expectedTestMatrixHardhat.json
  75. +46 −0 test/integration/projects/matrix/expectedTestMatrixTruffle.json
  76. +9 −0 test/integration/projects/matrix/hardhat.config.js
  77. +15 −0 test/integration/projects/matrix/test/matrix_a.js
  78. +30 −0 test/integration/projects/matrix/test/matrix_a_b.js
  79. +10 −0 test/integration/projects/matrix/truffle-config.js
  80. +8 −0 test/integration/projects/modifiers/.solcover.js
  81. +45 −0 test/integration/projects/modifiers/contracts/ModifiersA.sol
  82. +19 −0 test/integration/projects/modifiers/contracts/ModifiersB.sol
  83. +43 −0 test/integration/projects/modifiers/contracts/ModifiersC.sol
  84. +9 −0 test/integration/projects/modifiers/hardhat.config.js
  85. +40 −0 test/integration/projects/modifiers/test/modifiers.js
  86. 0 test/integration/projects/{solc-6 → modifiers}/truffle-config.js
  87. +0 −4 test/integration/projects/multiple-migrations/.solcover.js
  88. +0 −1 test/integration/projects/multiple-migrations/buidler.config.js
  89. +0 −17 test/integration/projects/multiple-migrations/contracts/ContractC.sol
  90. +0 −23 test/integration/projects/multiple-migrations/contracts/Migrations.sol
  91. +0 −5 test/integration/projects/multiple-migrations/migrations/1_initial_migration.js
  92. +0 −5 test/integration/projects/multiple-migrations/migrations/2_contracta.js
  93. +0 −5 test/integration/projects/multiple-migrations/migrations/3_contractb.js
  94. +0 −5 test/integration/projects/multiple-migrations/migrations/4_contractc.js
  95. +0 −15 test/integration/projects/multiple-migrations/test/contracta.js
  96. +0 −15 test/integration/projects/multiple-migrations/test/contractb.js
  97. +0 −20 test/integration/projects/multiple-migrations/test/contractc.js
  98. +0 −7 test/integration/projects/multiple-migrations/truffle-config.js
  99. +1 −1 test/integration/projects/multiple-suites/contracts/ContractA.sol
  100. +1 −1 test/integration/projects/multiple-suites/contracts/ContractB.sol
  101. +1 −1 test/integration/projects/multiple-suites/contracts/ContractC.sol
  102. +0 −23 test/integration/projects/multiple-suites/contracts/Migrations.sol
  103. +1 −1 test/integration/projects/multiple-suites/hardhat.config.js
  104. +0 −7 test/integration/projects/multiple-suites/truffle-config.js
  105. +1 −1 test/integration/projects/no-sources/hardhat.config.js
  106. +0 −7 test/integration/projects/no-sources/truffle-config.js
  107. +1 −1 test/integration/projects/skipping/contracts/ContractA.sol
  108. +0 −23 test/integration/projects/skipping/contracts/Migrations.sol
  109. +1 −1 test/integration/projects/skipping/contracts/skipped-folder/ContractB.sol
  110. +1 −1 test/integration/projects/skipping/hardhat.config.js
  111. +0 −5 test/integration/projects/skipping/migrations/1_initial_migration.js
  112. +0 −7 test/integration/projects/skipping/truffle-config.js
  113. +10 −0 test/integration/projects/solc-8/contracts/Contract_solc8.sol
  114. +4 −0 test/integration/projects/solc-8/test/test_solc8.js
  115. +8 −0 test/integration/projects/ternary-and-logical-or/.solcover.js
  116. +46 −0 test/integration/projects/ternary-and-logical-or/contracts/Contract_OR.sol
  117. +54 −0 test/integration/projects/ternary-and-logical-or/contracts/Contract_ternary.sol
  118. +9 −0 test/integration/projects/ternary-and-logical-or/hardhat.config.js
  119. +37 −0 test/integration/projects/ternary-and-logical-or/test/test_or.js
  120. +16 −0 test/integration/projects/ternary-and-logical-or/test/test_ternary.js
  121. +1 −1 test/integration/projects/test-files/contracts/ContractA.sol
  122. +1 −1 test/integration/projects/test-files/contracts/ContractB.sol
  123. +1 −1 test/integration/projects/test-files/contracts/ContractC.sol
  124. +1 −1 test/integration/projects/test-files/contracts/Migrations.sol
  125. +1 −1 test/integration/projects/test-files/hardhat.config.js
  126. +0 −7 test/integration/projects/test-files/truffle-config.js
  127. +1 −1 test/integration/projects/tests-folder/contracts/ContractA.sol
  128. +1 −1 test/integration/projects/tests-folder/contracts/ContractB.sol
  129. +1 −1 test/integration/projects/tests-folder/contracts/ContractC.sol
  130. +0 −23 test/integration/projects/tests-folder/contracts/Migrations.sol
  131. +1 −1 test/integration/projects/tests-folder/hardhat.config.js
  132. +0 −7 test/integration/projects/tests-folder/truffle-config.js
  133. +0 −16 test/sources/js/TestSimple.sol
  134. +8 −0 test/sources/js/modified.js
  135. +0 −4 test/sources/js/wallet.js
  136. +1 −1 test/sources/solidity/contracts/app/Empty.sol
  137. +4 −4 test/sources/solidity/contracts/app/Events.sol
  138. +2 −2 test/sources/solidity/contracts/app/Expensive.sol
  139. +1 −2 test/sources/solidity/contracts/app/Migrations.sol
  140. +20 −0 test/sources/solidity/contracts/app/Modified.sol
  141. +3 −3 test/sources/solidity/contracts/app/OnlyCall.sol
  142. +2 −2 test/sources/solidity/contracts/app/Owned.sol
  143. +2 −2 test/sources/solidity/contracts/app/Proxy.sol
  144. +2 −2 test/sources/solidity/contracts/app/Simple.sol
  145. +4 −4 test/sources/solidity/contracts/app/SimpleError.sol
  146. +1 −1 test/sources/solidity/contracts/app/Unparseable.sol
  147. +3 −3 test/sources/solidity/contracts/app/Wallet.sol
  148. +2 −4 test/sources/solidity/contracts/assembly/if.sol
  149. +2 −2 test/sources/solidity/contracts/assembly/spaces-in-function.sol
  150. +1 −1 test/sources/solidity/contracts/assert/Assert.sol
  151. +11 −0 test/sources/solidity/contracts/assert/Require-fn-reason.sol
  152. +11 −0 test/sources/solidity/contracts/assert/Require-fn.sol
  153. +2 −2 test/sources/solidity/contracts/assert/RequireMultiline.sol
  154. +1 −1 test/sources/solidity/contracts/comments/postContractComment.sol
  155. +1 −1 test/sources/solidity/contracts/comments/postFunctionDeclarationComment.sol
  156. +1 −1 test/sources/solidity/contracts/comments/postIfStatementComment.sol
  157. +1 −1 test/sources/solidity/contracts/comments/postLineComment.sol
  158. +9 −0 test/sources/solidity/contracts/conditional/and-condition.sol
  159. +2 −2 test/sources/solidity/contracts/conditional/declarative-exp-assignment-alternate.sol
  160. +2 −2 test/sources/solidity/contracts/conditional/identifier-assignment-alternate.sol
  161. +2 −2 test/sources/solidity/contracts/conditional/mapping-assignment.sol
  162. +4 −4 test/sources/solidity/contracts/conditional/multiline-alternate.sol
  163. +4 −4 test/sources/solidity/contracts/conditional/multiline-consequent.sol
  164. +9 −0 test/sources/solidity/contracts/conditional/or-always-false-condition.sol
  165. +9 −0 test/sources/solidity/contracts/conditional/or-condition.sol
  166. +2 −2 test/sources/solidity/contracts/conditional/sameline-alternate.sol
  167. +2 −2 test/sources/solidity/contracts/conditional/sameline-consequent.sol
  168. +9 −0 test/sources/solidity/contracts/conditional/unbracketed-condition.sol
  169. +9 −0 test/sources/solidity/contracts/conditional/unbracketed-or-condition.sol
  170. +2 −2 test/sources/solidity/contracts/conditional/variable-decl-assignment-alternate.sol
  171. +38 −0 test/sources/solidity/contracts/diff/addition.sol
  172. +23 −0 test/sources/solidity/contracts/diff/events.sol
  173. +34 −0 test/sources/solidity/contracts/diff/no-change.sol
  174. +33 −0 test/sources/solidity/contracts/diff/param-change.sol
  175. +29 −0 test/sources/solidity/contracts/diff/removal.sol
  176. +33 −0 test/sources/solidity/contracts/diff/reorder.sol
  177. +25 −0 test/sources/solidity/contracts/diff/return-sig.sol
  178. +13 −0 test/sources/solidity/contracts/diff/state-mod-change.sol
  179. +1 −1 test/sources/solidity/contracts/expressions/new-expression.sol
  180. +1 −1 test/sources/solidity/contracts/expressions/single-binary-expression.sol
  181. +4 −4 test/sources/solidity/contracts/function/abstract.sol
  182. +2 −2 test/sources/solidity/contracts/function/calldata.sol
  183. +4 −5 test/sources/solidity/contracts/function/chainable-new.sol
  184. +4 −4 test/sources/solidity/contracts/function/chainable-value.sol
  185. +4 −4 test/sources/solidity/contracts/function/chainable.sol
  186. +1 −1 test/sources/solidity/contracts/function/constructor-keyword.sol
  187. +2 −2 test/sources/solidity/contracts/function/empty-body.sol
  188. +3 −3 test/sources/solidity/contracts/function/function-call.sol
  189. +2 −2 test/sources/solidity/contracts/function/function.sol
  190. +1 −1 test/sources/solidity/contracts/function/modifier.sol
  191. +4 −4 test/sources/solidity/contracts/function/multiple.sol
  192. +1 −1 test/sources/solidity/contracts/if/else-if-unbracketed-multi.sol
  193. +2 −2 test/sources/solidity/contracts/if/else-if-without-brackets.sol
  194. +3 −3 test/sources/solidity/contracts/if/else-with-brackets.sol
  195. +5 −5 test/sources/solidity/contracts/if/else-without-brackets.sol
  196. +1 −1 test/sources/solidity/contracts/if/if-else-no-brackets.sol
  197. +3 −3 test/sources/solidity/contracts/if/if-elseif-else.sol
  198. +3 −3 test/sources/solidity/contracts/if/if-no-brackets-multiline.sol
  199. +2 −2 test/sources/solidity/contracts/if/if-no-brackets.sol
  200. +3 −3 test/sources/solidity/contracts/if/if-with-brackets-multiline.sol
  201. +2 −2 test/sources/solidity/contracts/if/if-with-brackets.sol
  202. +3 −3 test/sources/solidity/contracts/if/nested-if-missing-else.sol
  203. +2 −2 test/sources/solidity/contracts/loops/for-no-brackets.sol
  204. +2 −2 test/sources/solidity/contracts/loops/for-with-brackets.sol
  205. +3 −3 test/sources/solidity/contracts/loops/while-no-brackets.sol
  206. +2 −2 test/sources/solidity/contracts/loops/while-with-brackets.sol
  207. +18 −0 test/sources/solidity/contracts/modifiers/both-branches.sol
  208. +17 −0 test/sources/solidity/contracts/modifiers/constructor.sol
  209. +15 −0 test/sources/solidity/contracts/modifiers/duplicate-mods-same-fn.sol
  210. +21 −0 test/sources/solidity/contracts/modifiers/listed-modifiers.sol
  211. +16 −0 test/sources/solidity/contracts/modifiers/multiple-fns-same-mod.sol
  212. +17 −0 test/sources/solidity/contracts/modifiers/multiple-mods-same-fn.sol
  213. +16 −0 test/sources/solidity/contracts/modifiers/override-function.sol
  214. +14 −0 test/sources/solidity/contracts/modifiers/reverting-fn.sol
  215. +23 −0 test/sources/solidity/contracts/modifiers/reverting-neighbor.sol
  216. +12 −0 test/sources/solidity/contracts/modifiers/same-contract-fail.sol
  217. +12 −0 test/sources/solidity/contracts/modifiers/same-contract-pass.sol
  218. +11 −0 test/sources/solidity/contracts/or/and-or-brackets.sol
  219. +11 −0 test/sources/solidity/contracts/or/and-or.sol
  220. +19 −0 test/sources/solidity/contracts/or/bzx-or.sol
  221. +11 −0 test/sources/solidity/contracts/or/if-or.sol
  222. +11 −0 test/sources/solidity/contracts/or/multi-or.sol
  223. +11 −0 test/sources/solidity/contracts/or/require-multiline-or.sol
  224. +7 −0 test/sources/solidity/contracts/or/require-or.sol
  225. +7 −0 test/sources/solidity/contracts/or/return-or.sol
  226. +10 −0 test/sources/solidity/contracts/or/while-or.sol
  227. +7 −0 test/sources/solidity/contracts/return/empty-return.sol
  228. +3 −3 test/sources/solidity/contracts/return/return.sol
  229. +11 −0 test/sources/solidity/contracts/return/ternary-return.sol
  230. +2 −2 test/sources/solidity/contracts/statements/emit-coverage.sol
  231. +2 −2 test/sources/solidity/contracts/statements/emit-instrument.sol
  232. +2 −2 test/sources/solidity/contracts/statements/empty-contract-ala-melonport.sol
  233. +2 −2 test/sources/solidity/contracts/statements/empty-contract-body.sol
  234. +8 −8 test/sources/solidity/contracts/statements/fn-argument-multiline.sol
  235. +5 −5 test/sources/solidity/contracts/statements/fn-argument.sol
  236. +2 −2 test/sources/solidity/contracts/statements/fn-struct.sol
  237. +2 −2 test/sources/solidity/contracts/statements/interface.sol
  238. +1 −1 test/sources/solidity/contracts/statements/interpolation.sol
  239. +4 −2 test/sources/solidity/contracts/statements/library.sol
  240. +3 −3 test/sources/solidity/contracts/statements/multiple.sol
  241. +1 −1 test/sources/solidity/contracts/statements/post-close-brace.sol
  242. +3 −3 test/sources/solidity/contracts/statements/single.sol
  243. +1 −1 test/sources/solidity/contracts/statements/stack-too-deep.sol
  244. +2 −2 test/sources/solidity/contracts/statements/tuple.sol
  245. +1 −3 test/sources/solidity/contracts/statements/type-keyword.sol
  246. +1 −1 test/sources/solidity/contracts/statements/unary.sol
  247. +1 −1 test/sources/solidity/external/CLibrary.sol
  248. +1 −1 test/sources/solidity/external/Face.sol
  249. +1 −1 test/sources/solidity/external/PureView.sol
  250. +46 −6 test/units/assert.js
  251. +0 −93 test/units/buidler/errors.js
  252. +0 −114 test/units/buidler/flags.js
  253. +0 −85 test/units/buidler/standard.js
  254. +232 −0 test/units/conditional.js
  255. +128 −0 test/units/diff.js
  256. +10 −0 test/units/expressions.js
  257. +6 −4 test/units/function.js
  258. +58 −0 test/units/hardhat/flags.js
  259. +58 −1 test/units/hardhat/standard.js
  260. +9 −9 test/units/if.js
  261. +2 −2 test/units/loops.js
  262. +263 −0 test/units/modifiers.js
  263. +121 −0 test/units/options.js
  264. +378 −0 test/units/or.js
  265. +4 −4 test/units/statements.js
  266. +0 −235 test/units/truffle/errors.js
  267. +0 −274 test/units/truffle/flags.js
  268. +0 −501 test/units/truffle/standard.js
  269. +8 −2 test/units/validator.js
  270. +4 −106 test/util/integration.js
  271. +31 −10 test/util/util.js
  272. +14 −0 test/util/verifiers.js
  273. +0 −5 truffle-plugin.json
  274. +2,360 −4,918 yarn.lock
31 changes: 5 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -12,25 +12,21 @@ step_install_nvm: &step_install_nvm
set +e
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v12.16.0
nvm alias default v12.16.0
nvm install v14.19.0
nvm alias default v14.19.0
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
jobs:
unit-test:
docker:
- image: circleci/node:12
- image: circleci/node:14
steps:
- checkout
- run:
name: Delete any old node_modules
command: |
rm -rf node_modules/
- run:
name: Install truffle (globally)
command: |
sudo npm install -g truffle
- run:
name: Install dependencies
command: |
@@ -45,30 +41,15 @@ jobs:
bash <(curl -s https://codecov.io/bash)
e2e-zeppelin:
machine: true
environment:
NODE_OPTIONS: --max_old_space_size=8192
steps:
- checkout
- <<: *step_install_nvm
- run:
name: Zeppelin E2E
command: |
./scripts/run-zeppelin.sh
e2e-metacoin:
machine: true
steps:
- checkout
- <<: *step_install_nvm
- run:
name: MetaCoin E2E
command: |
./scripts/run-metacoin.sh
e2e-metacoin-windows:
executor: win/default
steps:
- checkout
- run:
name: Windows Metacoin E2E
command: |
bash ./scripts/run-metacoin.sh
e2e-nomiclabs:
machine: true
steps:
@@ -84,6 +65,4 @@ workflows:
jobs:
- unit-test
- e2e-zeppelin
- e2e-metacoin
- e2e-metacoin-windows
- e2e-nomiclabs
133 changes: 0 additions & 133 deletions BUIDLER_README.md

This file was deleted.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

0.7.21 / 2022-04-24
===================
* Add support for UncheckedStatement blocks (https://github.com/sc-forks/solidity-coverage/issues/712)
* Lazy load hardhat plugin resources (https://github.com/sc-forks/solidity-coverage/issues/711)

0.7.20 / 2022-02-15
===================
* Remove early V7 Truffle patches (https://github.com/sc-forks/solidity-coverage/issues/693)

0.7.19 / 2022-02-09
===================
* Update solidity-parser/parser to 0.14.0 - supports solidity user-defined types (https://github.com/sc-forks/solidity-coverage/issues/689)

0.7.18 2022-01-17
=================
* Add solcOptimizerDetails option to help workaround "stack too deep" errors (https://github.com/sc-forks/solidity-coverage/issues/683)
* Add __SOLIDITY_COVERAGE_RUNNING variable on global HH env for identifying solidity-coverage task from other tasks (https://github.com/sc-forks/solidity-coverage/issues/682)
* Fix hardhat_reset (https://github.com/sc-forks/solidity-coverage/issues/667)
* Add new hook and make temporary contracts directory configurable (https://github.com/sc-forks/solidity-coverage/issues/664)
* Use internal visibility for fn level hash method defs (https://github.com/sc-forks/solidity-coverage/issues/660)

0.7.16 / 2021-03-04
===================
* Update @solidity-parser/parser to ^0.12.0 (and support Panic keyword in catch clauses) (https://github.com/sc-forks/solidity-coverage/issues/621)
77 changes: 31 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,67 +14,40 @@
see [the accompanying article][16].
+ `solidity-coverage` is [Solcover][17]

## Install
```
$ npm install --save-dev solidity-coverage
```

**Resources**:
+ [0.7.0 release notes][31]
+ [A guide][29] to upgrading from 0.6.x to 0.7.x
+ [0.6.3 docs][30]
## Requirements

### Truffle V5
+ Hardhat >= 2.11.0

**Add** this package to your plugins array in `truffle-config.js` ([Truffle docs][27])
```javascript
module.exports = {
networks: {...},
plugins: ["solidity-coverage"]
}
```
**Run**
## Install
```
truffle run coverage [command-options]
$ yarn add solidity-coverage --dev
```

### Hardhat

Beginning with v0.7.12, this tool supports Hardhat and runs directly on
HardhatEVM.

**Require** the plugin in `hardhat.config.js` ([Hardhat docs][26])
```javascript
require('solidity-coverage')
```

**Run**
Or, if you are using TypeScript, add this to your hardhat.config.ts:
```ts
import 'solidity-coverage'
```
**Resources**:
+ [0.8.0 release notes][31]

## Run
```
npx hardhat coverage [command-options]
```

(Additional Hardhat-specific info can be found [here][37])

### @openzeppelin/test-environment

OpenZeppelin have written their own coverage generation scripts for `test-environment` using the solidity-coverage API.
A working example can be found at [openzeppelin-contracts, here.][35]

## Usage notes:
+ Coverage runs tests a little more slowly.
+ Coverage launches its own in-process ganache server.
+ You can set [ganache options][1] using the `providerOptions` key in your `.solcover.js` [config][15].
+ Coverage [distorts gas consumption][13]. Tests that check exact gas consumption should be [skipped][24].
+ :warning: Contracts are compiled **without optimization**. Please report unexpected compilation faults to [issue 417][25]

## Command Options
| Option <img width=200/> | Example <img width=750/>| Description <img width=1000/> |
|--------------|------------------------------------|--------------------------------|
| file | `--file="test/registry/*.js"` | (Truffle) Filename or glob describing a subset of tests to run. (Globs must be enclosed by quotes and use [globby matching patterns][38])|
| testfiles | `--testfiles "test/registry/*.ts"` | (Buidler) Test file(s) to run. (Globs must be enclosed by quotes and use [globby matching patterns][38])|
| testfiles | `--testfiles "test/registry/*.ts"` | Test file(s) to run. (Globs must be enclosed by quotes and use [globby matching patterns][38])|
| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
| network | `--network development` | Use network settings defined in the Truffle or Buidler config |
| network | `--network development` | Use network settings defined in the Hardhat config |
| temp[<sup>*</sup>][14] | `--temp build` | :warning: **Caution** :warning: Path to a *disposable* folder to store compilation artifacts in. Useful when your test setup scripts include hard-coded paths to a build directory. [More...][14] |
| matrix | `--matrix` | Generate a JSON object that maps which mocha tests hit which lines of code. (Useful as an input for some fuzzing, mutation testing and fault-localization algorithms.) [More...][39]|

[<sup>*</sup> Advanced use][14]

@@ -93,11 +66,14 @@ module.exports = {
| Option <img width=200/>| Type <img width=200/> | Default <img width=1300/> | Description <img width=800/> |
| ------ | ---- | ------- | ----------- |
| silent | *Boolean* | false | Suppress logging output |
| client | *Object* | `require("ganache-core")` | Useful if you need a specific ganache version. |
| providerOptions | *Object* | `{ }` | [ganache-core options][1] |
| skipFiles | *Array* | `['Migrations.sol']` | Array of contracts or folders (with paths expressed relative to the `contracts` directory) that should be skipped when doing instrumentation. |
| measureStatementCoverage | *boolean* | `true` | Computes statement (in addition to line) coverage. [More...][34] |
| measureFunctionCoverage | *boolean* | `true` | Computes function coverage. [More...][34] |
| measureModifierCoverage | *boolean* | `true` | Computes each modifier invocation as a code branch. [More...][34] |
| modifierWhitelist | *String[]* | `[]` | List of modifier names (ex: "onlyOwner") to exclude from branch measurement. (Useful for modifiers which prepare something instead of acting as a gate.)) |
| matrixOutputPath | *String* | `./testMatrix.json` | Relative path to write test matrix JSON object to. [More...][39]|
| mochaJsonOutputPath | *String* | `./mochaOutput.json` | Relative path to write mocha JSON reporter object to. [More...][39]|
| abiOutputPath | *String* | `./humanReadableAbis.json` | Relative path to write diff-able ABI data to |
| istanbulFolder | *String* | `./coverage` | Folder location for Istanbul coverage reports. |
| istanbulReporter | *Array* | `['html', 'lcov', 'text', 'json']` | [Istanbul coverage reporters][2] |
| mocha | *Object* | `{ }` | [Mocha options][3] to merge into existing mocha config. `grep` and `invert` are useful for skipping certain tests under coverage using tags in the test descriptions.|
@@ -108,10 +84,16 @@ module.exports = {
| onTestsComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* the tests complete, *before* Istanbul reports are generated. [More...][23]|
| onIstanbulComplete[<sup>*</sup>][14] | *Function* | | Hook run *after* the Istanbul reports are generated, *before* the ganache server is shut down. Useful if you need to clean resources up. [More...][23]|
| configureYulOptimizer | *Boolean* | false | (Experimental) Setting to `true` should resolve "stack too deep" compiler errors in large projects using ABIEncoderV2 |
| solcOptimizerDetails | *Object* | (Experimental) Must be used in combination with `configureYulOptimizer`Allows you define the [solc optimizer details][1001]. Useful if the default remedy for stack-too-deep errors doesn't work in your case (See FAQ below). |
| solcOptimizerDetails | *Object* | `undefined` |(Experimental) Must be used in combination with `configureYulOptimizer`. Allows you configure solc's [optimizer details][1001]. Useful if the default remedy for stack-too-deep errors doesn't work in your case (See FAQ below). |
| client | *Object* | `require("ganache-core")` | Ganache only: useful if you need a specific ganache version |
| providerOptions | *Object* | `{ }` | Ganache only: [ganache-core options][1] |


[<sup>*</sup> Advanced use][14]

## Viewing the reports:
+ You can find the Istanbul reports written to the `./coverage/` folder generated in your root directory.

## API

Solidity-coverage's core methods and many utilities are available as an API.
@@ -138,7 +120,7 @@ Common problems & questions:
+ [Running in CI][7]
+ [Running out of gas][13]
+ [Running out of time][6]
+ [Running out of stack] [1002] (Stack too deep)
+ [Running out of stack][1002] (Stack too deep)
+ [Running out of memory][5]

## Example reports
@@ -187,6 +169,8 @@ $ yarn
+ [@paulrberg](https://github.com/paulrberg)
+ [@adjisb](https://github.com/adjisb)
+ [@Shelvak](https://github.com/Shelvak)
+ [@rynobey](https://github.com/rynobey)
+ [@ZumZoom](https://github.com/ZumZoom)

[1]: https://github.com/trufflesuite/ganache-core#options
[2]: https://istanbul.js.org/docs/advanced/alternative-reporters/
@@ -226,6 +210,7 @@ $ yarn
[36]: https://hardhat.org/
[37]: https://github.com/sc-forks/solidity-coverage/blob/master/HARDHAT_README.md
[38]: https://github.com/sindresorhus/globby#globbing-patterns
[39]: https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md#generating-a-test-matrix
[1001]: https://docs.soliditylang.org/en/v0.8.0/using-the-compiler.html#input-description
[1002]: https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-out-of-stack

Loading