从命令行运行guard-jasmine不会运行任何规范

我已经设置了spec /
javascripts / spec.js.coffee,并且在spec / javascripts中有一个包含3个测试的spec文件.当我在浏览器中运行jasmine时,运行3个测试.

当我运行后卫并启动并运行guard-jasmine时,它会找到并运行我的所有测试,如下所示:

$bundle exec guard
Guard uses GNTP to send notifications.
Guard is now watching at '/workpath'
Guard::Jasmine starts Unicorn test server on port 52512 in development environment.
Waiting for Jasmine test runner at http://localhost:52512/jasmine
Run all Jasmine suites
Run Jasmine suite at http://localhost:52512/jasmine

Finished in 0.013 seconds
3 specs, 0 failures
Done.

但是,当我从终端运行guard-jasmine时,没有找到任何规格:

$guard-jasmine
Guard::Jasmine starts Unicorn test server on port 53307 in test environment.
Waiting for Jasmine test runner at http://localhost:53307/jasmine
Run all Jasmine suites
Run Jasmine suite at http://localhost:53307/jasmine

Finished in 0.001 seconds
0 specs, 0 failures
Done.

Guard::Jasmine stops server.

有什么想法我需要改变以帮助CLI转轮找到我的规格?

谢谢.

编辑:添加相关的Guardfile信息:

guard :jasmine, timeout: 120, server_timeout: 120, server_env: "test" do
  watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { 'spec/javascripts' }
  watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
  watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
end

最佳答案 问题在于,默认情况下,guard会在开发环境中运行,而rake任务和可执行的guard-jasmine会在测试时运行.

我通过将config.assets.debug = true添加到测试环境配置来修复它.

点赞