【问题标题】:How to include a directory and your subdirectories with simplecov如何使用 simplecov 包含目录和您的子目录
【发布时间】:2017-08-17 14:19:11
【问题描述】:

如何将我的库的文件夹和子文件夹添加到simplecov 生成覆盖范围?

我的SimpleCov 配置

  SimpleCov.start do
    add_group 'Bot', 'app/bots'
    add_group 'Bot', 'lib/bot'
    add_group 'Controllers', 'app/controllers'
    add_group 'Models', 'app/models'
    add_group 'Helpers', 'app/helpers'
    add_group 'Libraries', 'lib'
  end

这是我的库树

├── assets
├── bot
│   ├── base_bot_logic.rb
│   ├── bot_logic.rb
│   ├── core
│   │   ├── blacklist.rb
│   │   ├── bot_core.rb
│   │   ├── broadcast.rb
│   │   ├── emoji.rb
│   │   ├── profile.rb
│   │   ├── reply.rb
│   │   ├── setup.rb
│   │   ├── state_machine.rb
│   │   └── webview.rb
│   └── geoutils
│       └── geoutils.rb
├── estrutura.txt
├── solar
│   ├── api.rb
│   ├── assistido.rb
│   ├── atendimento.rb
│   └── validation
│       └── cpf.rb
├── solar.rb
└── tasks

7 directories, 18 files

但是SimpleCov只识别了两个文件。

如何添加丢失的文件夹?

编辑:

我在 SimpleCov.start 中添加了track_files '{app,lib}/**/*.rb',它可以识别 mys 文件,但不计算覆盖率。

【问题讨论】:

    标签: ruby simplecov


    【解决方案1】:

    虽然我错过了聚会,但我会回答

    Getting started 包含您问题的答案:

    如果 SimpleCov 在您的应用程序代码已经加载后启动(通过 要求),它将无法跟踪您的文件及其覆盖范围!这 SimpleCov.start 必须在您的任何应用程序代码发布之前发出 必填!

    这样,它正确

    需要'simplecov'

    需要“你的应用”

    它的不正确

    需要“你的应用”

    需要'simplecov'

    track_files 只包含与此 glob 匹配的文件,无论它们是否被明确要求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 2018-05-28
      • 1970-01-01
      • 2016-02-11
      • 2021-06-19
      相关资源
      最近更新 更多