@abradley2/elm-coverage 中文文档教程

发布于 4年前 浏览 21 项目主页 更新于 3年前

Fork of for zwilias/elm-coverage 所以我可以使用它通过 npm 安装 0.19.1

Elm Coverage Build StatusBuild statusDocumentation Status

正在进行中 - Elm 的代码覆盖率

工具 <代码>榆树测试。

elm-coverage 生成的报告的目标是帮助您可视化 运行测试时评估代码的哪些部分,并尝试 并指导您编写专门针对更复杂的测试 在您的代码库中运行。

我们的目标是将该信息压缩成一个单一的指标。 它 编写对代码没有有意义的断言的测试太容易了 及其行为,但只会增加覆盖面。

唯一比没有测试更糟糕的是有提供错误的测试 安全感。

如需进一步阅读,请直接访问 https://elm-coverage.readthedocs.io

Installation

安装 elm-coverage 的工作方式与安装其他工具的方式大致相同 Elm 生态系统:

npm i -g elm-coverage

Usage

最简单的 elm-coverage 调用是简单地调用 elm-coverage 项目的根目录:

elm-coverage

默认情况下,elm-coverage 假定您的源代码存在于单独的 src/ 中 目录,您在全局安装了 elm-test,并且那个 elm-test 不需要进一步的特殊标志。

您可以指定一个替代路径来抓取要检测的源:

elm-coverage elm_src/

如果您不想使用全局安装的 elm-test,您可以指定 elm-test 可执行文件的路径:

elm-coverage --elm-test ./node_modules/.bin/elm-test

-- 之后的参数被传递给 elm-test,例如 指定初始 seedfuzz 测试运行次数:

elm-coverage -- --seed 12345 --fuzz 99

elm-coverage 会将 HTML 报告写入 .coverage/coverage.html< /代码>。 它不是 建议对该目录进行版本控制。 为了打开报表一次 它已生成,您可以指定 --open 选项:

elm-coverage --open

Contribute

Issues and source code is available on 知乎。 的来源 elm-instrument 用于实际检测源,以便 计算覆盖率也是 可用

License

elm-coverage 根据 BSD-3 许可证获得许可。 elm-instrument 是 根据 BSD-3 许可证获得许可。

Fork of for zwilias/elm-coverage so I can use it with 0.19.1 via an npm install

Elm Coverage Build StatusBuild statusDocumentation Status

Work in progress - Code coverage tooling for Elm

elm-coverage is a tool for calculating code coverage for Elm code tested with elm-test.

The goal of the reports generated by elm-coverage is to help you visualize what parts of your code are being evaluated when running your tests, and to try and guide you towards writing tests that focus specifically on the more complex functions in your codebase.

The goal is not to condense that information down into a single metric. It is too easy to write tests that don't make meaningful assertions about your code and its behaviour, but only serve to increase the coverage.

The only thing worse than having no tests is having tests that provide a false sense of security.

For further reading, please direct yourself to https://elm-coverage.readthedocs.io

Installation

Installing elm-coverage works much the same way as installing other tools in the Elm ecosystem:

npm i -g elm-coverage

Usage

The simplest invocation of elm-coverage is to simply invoke elm-coverage in the root of your project:

elm-coverage

By default, elm-coverage assumes that your sources exist in a separate src/ directory, that you have elm-test installed globally, and that elm-test needs no further, special flags.

You can specify an alternative path to crawl for sources to instrument:

elm-coverage elm_src/

If you don't want to use a globally installed elm-test, you can specify the path to an elm-test executable:

elm-coverage --elm-test ./node_modules/.bin/elm-test

Parameters following -- are passed through to elm-test, for example to specify the initial seed and number of fuzz testruns:

elm-coverage -- --seed 12345 --fuzz 99

elm-coverage will write an HTML report to .coverage/coverage.html. It is not recommended to version control this directory. In order to open the report once it is generated, you can specify the --open option:

elm-coverage --open

Contribute

Issues and source code is available on github. The source for elm-instrument which is used to actually instrument the sources in order to calculate coverage is also available.

License

elm-coverage is licensed under the BSD-3 license. elm-instrument is licensed under the BSD-3 license.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文