solidity-coverage – 坚固性覆盖区块链毕设代写
区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,solidity-coverage – 坚固性覆盖区块链毕设代写 是一篇很好的国外资料
solidity-coverage
Code coverage for Solidity testing
- For more details about what this is, how it works and potential limitations, see the accompanying article.
solidity-coverage
is Solcover
Install
$ npm install --save-dev solidity-coverage
Resources:
- 0.7.0 release notes
- A guide to upgrading from 0.6.x to 0.7.x
- 0.6.3 docs
Truffle V5
Add this package to your plugins array in truffle-config.js
(Truffle docs)
module.exports = { networks: {...}, plugins: ["solidity-coverage"] }
Run
truffle run coverage [command-options]
Buidler
Add the plugin in buidler.config.js
(Buidler docs)
usePlugin('solidity-coverage') module.exports = { networks: { coverage: { url: 'http://localhost:8555' } }, }
Run
npx buidler coverage --network coverage [command-options]
Buidler Project Examples:
- Simple: buidler-metacoin
- More complex: MolochDao/moloch
Usage notes:
- Coverage runs tests a little more slowly.
- Coverage launches its own in-process ganache server.
- You can set ganache options using the
providerOptions
key in your.solcover.js
config. - Coverage distorts gas consumption. Tests that check exact gas consumption should be skipped.
⚠️ Contracts are compiled without optimization. Please report unexpected compilation faults to issue 417
Command Options
Option |
Example |
Description |
---|---|---|
file | --file="test/registry/*.js" |
(Truffle) Filename or glob describing a subset of tests to run. (Globs must be enclosed by quotes.) |
testfiles | --testfiles "test/registry/*.ts" |
(Buidler) Test file(s) to run. (Globs must be enclosed by quotes.) |
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 |
temp* | --temp build |
* Advanced use
Config Options
Additional options can be specified in a .solcover.js
config file located in the root directory of your project.
Example:
module.exports = { skipFiles: ['Routers/EtherRouter.sol'] };
Option |
Type |
Default |
Description |
---|---|---|---|
silent | Boolean | false | Suppress logging output |
client | Object | require("ganache-core") |
Useful if you need a specific ganache version. |
providerOptions | Object | { } |
ganache-core options |
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… |
measureFunctionCoverage | boolean | true |
Computes function coverage. More… |
istanbulFolder | String | ./coverage |
Folder location for Istanbul coverage reports. |
istanbulReporter | Array | ['html', 'lcov', 'text', 'json'] |
Istanbul coverage reporters |
mocha | Object | { } |
Mocha options to merge into existing mocha config. grep and invert are useful for skipping certain tests under coverage using tags in the test descriptions. |
onServerReady* | Function | Hook run after server is launched, before the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server’s availability. More… | |
onCompileComplete* | Function | Hook run after compilation completes, before tests are run. Useful if you have secondary compilation steps or need to modify built artifacts. More… | |
onTestsComplete* | Function | Hook run after the tests complete, before Istanbul reports are generated. More… | |
onIstanbulComplete* | 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… |
* Advanced use
API
Solidity-coverage’s core methods and many utilities are available as an API.
const CoverageAPI = require('solidity-coverage/api');
Documentation available here.
FAQ
Common problems & questions:
- Running in CI
- Running out of gas
- Running out of time
- Running out of memory
- Why are
require
statements highlighted as branch points?
Example reports
- metacoin (Istanbul HTML)
- openzeppelin-solidity(Coveralls)
Contribution Guidelines
Contributions are welcome! If you’re opening a PR that adds features or options please consider writing full unit tests for them. (We’ve built simple fixtures for almost everything and are happy to add some for your case if necessary).
Set up the development environment with:
$ git clone https://github.com/sc-forks/solidity-coverage.git $ yarn
Contributors
- @area
- @cgewecke
- @adriamb
- @cag
- @maurelian
- @rudolfix
- @phiferd
- @e11io
- @elenadimitrova
- @ukstv
- @vdrg
- @andresliva
- @DimitarSD
- @sohkai
- @bingen
- @pinkiebell
- @obernardovieira
- @angus-hamill
- @kandrianov
- @yxliang01
- @maxsam4
- @justinjmoses
We use cookies and similar technologies (“cookies”) to provide and secure our websites, as well as to analyze the usage of our websites, in order to offer you a great user experience. To learn more about our use of cookies see our Privacy Statement.
Select Accept all to consent to this use, Reject all to decline this use, or More info to control your cookie preferences. You can always update your selection by clicking Cookie Preferences at the bottom of the page.
We use cookies and similar technologies (“cookies”) to provide and secure our websites, as well as to analyze the usage of our websites, in order to offer you a great user experience. To learn more about our use of cookies see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they’re used to log you in. Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they’re used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more
贡献者
<>
><
><
><
><
>
<>
资源:
将此包添加到truffle中的plugins数组中-配置文件(Truffle docs)
运行
将插件添加到builder.config.js(Buidler文档)
运行
Builder项目示例:
*高级使用
可以在中指定其他选项。solcover.js公司位于项目根目录中的配置文件。
示例:
*高级用途
Solidity coverage的核心方法和许多实用程序都可以作为API提供。
此处提供文档。
常见问题和问题:
欢迎投稿!如果你正在打开一个添加特性或选项的PR,请考虑为它们编写完整的单元测试。(我们为几乎所有的东西都建立了简单的固定装置,如果需要,我们很乐意为您的案例添加一些装置)。
设置开发环境:
我们使用Cookie和类似技术(“Cookie”)来提供和保护我们的网站,并分析我们网站的使用情况,以便为您提供出色的用户体验。要了解更多有关cookies使用的信息,请参阅我们的隐私声明。
选择“全部接受”以同意此使用,选择“全部拒绝”以拒绝此使用,或选择“更多信息”以控制cookie首选项。您可以随时通过单击页面底部的Cookie首选项来更新您的选择。
我们使用Cookie和类似技术(“Cookie”)来提供和保护我们的网站,并分析我们网站的使用情况,以便为您提供出色的用户体验。要了解更多有关cookies使用的信息,请参阅我们的隐私声明。
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多关于solidity测试的代码覆盖率的信息
贡献者
基本cookies
始终活动的
分析cookies
分析cookies
{}
基本cookies
<>
- 有关这是什么、如何工作以及潜在限制的更多详细信息,请参阅随附的文章。solidity coverage是Solcover
- 0.7.0发行说明
始终活动的
分析cookies
分析cookies
{}
$ npm install --save-dev solidity-coverage
资源:
- 从0.6.x升级到0.7.x的指南。
- Coverage启动了自己的进程内ganache服务器。
- 您可以使用中的providerOptions键设置ganache选项。solcover.js公司配置。
分析cookies
{}
将此包添加到truffle中的plugins数组中-配置文件(Truffle docs)
module.exports = { networks: {...}, plugins: ["solidity-coverage"] }
运行
truffle run coverage [command-options]
分析cookies
将插件添加到builder.config.js(Buidler文档)
usePlugin('solidity-coverage') module.exports = { networks: { coverage: { url: 'http://localhost:8555' } }, }
运行
npx buidler coverage --network coverage [command-options]
Builder项目示例:
- 覆盖率扭曲了天然气消耗量。应跳过检查准确耗气量的测试。
- ⚠️ 合同是在没有优化的情况下编译的。请将意外的编译错误报告给问题417
Usage notes:
- 正在运行CI
- 耗尽时间
- 内存不足
- 为什么将require语句突出显示为分支点?
⚠️ Contracts are compiled without optimization. Please report unexpected compilation faults to issue 417
Command Options
Option |
Example |
Description |
---|---|---|
testfiles | –testfiles“test/registry/*.ts” | (Buildler)要运行的测试文件。(全局必须用引号括起来。) |
solcoverjs | –solcoverjs./../../。solcover.js公司 | 从工作目录到配置的相对路径。对于共享设置的monorepo包很有用。(路径必须以“./”为前缀) |
网络⚠️ 小心⚠️ 用于存储编译项目的一次性文件夹的路径。当测试设置脚本包含指向生成目录的硬编码路径时非常有用。更多。。。 | silent | 布尔值 |
false | 禁止日志记录输出 | 客户端 |
对象 | require(“ganache core”) | 如果需要特定的ganache版本,则非常有用。 |
*高级使用
Config Options
可以在中指定其他选项。solcover.js公司位于项目根目录中的配置文件。
示例:
module.exports = { skipFiles: ['Routers/EtherRouter.sol'] };
Option |
Type |
Default |
Description |
---|---|---|---|
提供程序选项迁移.sol’] | 在执行指令插入时应跳过的协定或文件夹数组(路径相对于contracts目录表示)。 | measureStatementCoverage | 布尔值 |
true | 计算语句(除了行)覆盖率。更多。。。 | 测量函数覆盖率 | 布尔值 |
true | 计算函数覆盖率。更多。。。 | istanbulFolder | String |
/coverage | 伊斯坦布尔报道的文件夹位置。 | istanbullreporter | 数组 |
[‘html’,’lcov’,’text’,’json’] | 伊斯坦布尔报道记者 | 摩卡 | 对象 |
摩卡选项合并到现有的mocha配置中。grep和invert对于使用测试描述中的标记跳过覆盖范围内的某些测试非常有用。 | onServerReady* | 函数 | Computes function coverage. More… |
在服务器启动后、测试执行之前进行挂接运行。如果您需要使用Oraclize网桥或具有依赖于服务器可用性的安装脚本,则非常有用。更多。。。 | onCompileComplete* | 函数 | Folder location for Istanbul coverage reports. |
编译完成后,测试运行之前,钩子运行。如果您有二级编译步骤或需要修改生成的构件,则非常有用。更多。。。 | onTestsComplete* | 功能 | Istanbul coverage reporters |
测试完成后,生成伊斯坦布尔报告之前的挂接运行。更多。。。 | olisanbullcomplete* | 功能 | Mocha options to merge into existing mocha config. grep and invert are useful for skipping certain tests under coverage using tags in the test descriptions. |
生成伊斯坦布尔报告后,在ganache服务器关闭之前进行挂接运行。如果需要清理资源,则非常有用。更多。。。 | Function | Hook run after server is launched, before the tests execute. Useful if you need to use the Oraclize bridge or have setup scripts which rely on the server’s availability. More… | |
onCompileComplete* | Function | Hook run after compilation completes, before tests are run. Useful if you have secondary compilation steps or need to modify built artifacts. More… | |
onTestsComplete* | Function | Hook run after the tests complete, before Istanbul reports are generated. More… | |
onIstanbulComplete* | 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… |
*高级用途
API
Solidity coverage的核心方法和许多实用程序都可以作为API提供。
const CoverageAPI = require('solidity-coverage/api');
此处提供文档。
FAQ
常见问题和问题:
- Running in CI
- metacoin(伊斯坦布尔HTML)
- openzeppelinsolidity(工作服)openzeppelinsolidity(工作服)
- Running out of memory
- @面积
Example reports
- @cgeewece
- @adriambadriamb
Contribution Guidelines
欢迎投稿!如果你正在打开一个添加特性或选项的PR,请考虑为它们编写完整的单元测试。(我们为几乎所有的东西都建立了简单的固定装置,如果需要,我们很乐意为您的案例添加一些装置)。
设置开发环境:
$ git clone https://github.com/sc-forks/solidity-coverage.git $ yarn
Contributors
- @area
- @cag
- @adriamb
- @cag
- @rudolffix
- @phiferd
- @phiferd
- @e11io
- @elenadimitrova
- @ukstv
- @vdrg
- @andresliva
- @DimitarSD
- <李>
- <李><李><李><李><李视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉视觉
- @andersliva
- @一个能流能流的、能流能流、能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流能流流能流流能流流能流流能流流能流流能流流能流流能流流能流能流能流能流流能流流能流流能流流流能流流能流流流能流能流流流能流流能流流能流流能流流能流流能流流能流流流能流流能流流流能流流流能流能流流流能流流流能流流能流流流能流流流能流流流流流流流流流能流流流流流流流流流流流流流流流流流流流流流流试验跑。(Globs必须用引号括起来。)
testfiles –testfiles“test/registry/*.ts” (Buildler)要运行的测试文件。(全局必须用引号括起来。) solcoverjs –solcoverjs./../../。solcover.js公司 从工作目录到配置的相对路径。对于共享设置的monorepo包很有用。(路径必须以“./”为前缀) 网络⚠️ 小心⚠️ 用于存储编译项目的一次性文件夹的路径。当测试设置脚本包含指向生成目录的硬编码路径时非常有用。更多。。。 silent 布尔值 false 禁止日志记录输出 客户端 对象 require(“ganache core”) 如果需要特定的ganache版本,则非常有用。 提供程序选项迁移.sol’] 在执行指令插入时应跳过的协定或文件夹数组(路径相对于contracts目录表示)。 measureStatementCoverage 布尔值 true 计算语句(除了行)覆盖率。更多。。。 测量函数覆盖率 布尔值 true 计算函数覆盖率。更多。。。 istanbulFolder String /coverage 伊斯坦布尔报道的文件夹位置。 istanbullreporter 数组 [‘html’,’lcov’,’text’,’json’] 伊斯坦布尔报道记者 摩卡 对象 {}
摩卡选项合并到现有的mocha配置中。grep和invert对于使用测试描述中的标记跳过覆盖范围内的某些测试非常有用。 onServerReady* 函数 在服务器启动后、测试执行之前进行挂接运行。如果您需要使用Oraclize网桥或具有依赖于服务器可用性的安装脚本,则非常有用。更多。。。 onCompileComplete* 函数 编译完成后,测试运行之前,钩子运行。如果您有二级编译步骤或需要修改生成的构件,则非常有用。更多。。。 onTestsComplete* 功能 测试完成后,生成伊斯坦布尔报告之前的挂接运行。更多。。。 olisanbullcomplete* 功能 生成伊斯坦布尔报告后,在ganache服务器关闭之前进行挂接运行。如果需要清理资源,则非常有用。更多。。。 - @angus-hamill
- @kandrianov
- @yxliang01
- @maxsam4
- @justinjmoses
我们使用Cookie和类似技术(“Cookie”)来提供和保护我们的网站,并分析我们网站的使用情况,以便为您提供出色的用户体验。要了解更多有关cookies使用的信息,请参阅我们的隐私声明。
选择“全部接受”以同意此使用,选择“全部拒绝”以拒绝此使用,或选择“更多信息”以控制cookie首选项。您可以随时通过单击页面底部的Cookie首选项来更新您的选择。
我们使用Cookie和类似技术(“Cookie”)来提供和保护我们的网站,并分析我们网站的使用情况,以便为您提供出色的用户体验。要了解更多有关cookies使用的信息,请参阅我们的隐私声明。
Essential cookies
我们使用基本Cookie来执行基本的网站功能,例如,它们用于让您登录。了解更多
Always active
Analytics cookies
我们使用analytics Cookie来了解您如何使用我们的网站,以便我们能够使其变得更好,例如,它们用于收集有关您访问的页面以及完成一项任务需要多少次单击的信息。了解更多关于solidity测试的代码覆盖率的信息
贡献者
基本cookies
始终活动的
分析cookies
分析cookies
{}
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » solidity-coverage – 坚固性覆盖区块链毕设代写