【问题标题】:How can I exclude a particular file from test coverage analysis?如何从测试覆盖率分析中排除特定文件?
【发布时间】:2019-09-25 10:24:25
【问题描述】:

我的 Elixir 应用程序中有一些文件要从测试覆盖率报告中排除。我现在没有使用任何花哨的覆盖工具; (虽然我不接受使用此类工具的可能性)我现在只是在使用mix test --cover

我如何告诉覆盖分析工具给定文件不应包含在覆盖分析中?

【问题讨论】:

    标签: elixir elixir-mix


    【解决方案1】:

    目前无法直接在 Elixir 中进行。我知道有两个库可以排除特定模块。

    Coverexhttps://github.com/alfert/coverex

    工作服https://github.com/parroty/excoveralls

    看看你是否喜欢它们。有关此主题的更多信息,请查看这些链接。

    https://elixirforum.com/t/code-coverage-tools-for-elixir/18102/2

    https://elixirforum.com/t/add-ability-to-exclude-specific-functions-modules-files-from-test-coverage-reports/15743/1

    【讨论】:

      【解决方案2】:

      Elixir v1.11 添加了:ignore_modules。见https://hexdocs.pm/mix/1.11.0/Mix.Tasks.Test.html#module-coverage

      这是一个例子:

        def project do
          [
            # ...
            test_coverage: [ignore_modules: [Exclude.This, Exclude.That]]
          ]
        end
      

      【讨论】:

        猜你喜欢
        • 2017-07-23
        • 2019-05-08
        • 1970-01-01
        • 2022-08-17
        • 2011-08-02
        • 1970-01-01
        • 2019-10-19
        • 1970-01-01
        • 2015-09-02
        相关资源
        最近更新 更多