Heroku CI 测试应用程序删除 /spec 目录

Heroku CI test app deletes /spec directory

由于某些无法解释的原因,当 Heroku CI 在测试环境中构建应用程序时,它似乎删除了我的 /spec 目录。

下面的错误说,require': cannot load such file -- spec_helper (LoadError)

当我使用 Heroku 调试器时 heroku ci:debug --pipeline myapp 我发现没有 spec 目录。如果我 运行 rakebundle exec rake 它会给我在构建 UI 中看到的相同错误。

为什么要删除这个目录?

-----> Running test command `rake`...
/app/vendor/ruby-2.3.7/bin/ruby -I/app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib:/app/vendor/bundle/ruby/2.3.0/gems/rspec-support-3.7.1/lib /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
/app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1455:in `require': cannot load such file -- spec_helper (LoadError)
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1455:in `block in requires='
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1455:in `each'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1455:in `requires='
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration_options.rb:112:in `block in process_options_into'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration_options.rb:111:in `each'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration_options.rb:111:in `process_options_into'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration_options.rb:21:in `configure'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:99:in `setup'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:86:in `run'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:71:in `run'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:45:in `invoke'
    from /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/exe/rspec:4:in `<main>'
/app/vendor/ruby-2.3.7/bin/ruby -I/app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/lib:/app/vendor/bundle/ruby/2.3.0/gems/rspec-support-3.7.1/lib /app/vendor/bundle/ruby/2.3.0/gems/rspec-core-3.7.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
-----> test command `rake` failed with exit status 1

在 heroku 中,有一个名为 .slugignore 的文件。有人将 /spec 目录添加到该文件,所以我的 CI 构建不能 运行。

不要将您的规范目录添加到 .slugignore!