jcm
jcm

Reputation: 61

Running guard-jasmine from command line doesn't run any specs

I've set up spec/javascripts/spec.js.coffee and have one spec file with 3 tests in spec/javascripts. When I run jasmine within the browser, the 3 tests run.

When I run guard and it starts and runs guard-jasmine, it finds and runs all my tests, like so:

$ 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.

But, when I run guard-jasmine from the terminal, no specs are found:

$ 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.

Any idea as to what I need to change to help the CLI runner find my specs?

Thanks.

Edit: adding the relevant Guardfile info:

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

Upvotes: 4

Views: 1264

Answers (1)

jcm
jcm

Reputation: 61

The issue was that guard runs on development environment by default, whereas the rake task and the executable guard-jasmine do on test.

I fixed it by adding config.assets.debug = true to the test environment configuration.

Upvotes: 2

Related Questions