Skip to content

Instantly share code, notes, and snippets.

@hannahwhy
Created September 29, 2010 22:25
Show Gist options
  • Select an option

  • Save hannahwhy/603680 to your computer and use it in GitHub Desktop.

Select an option

Save hannahwhy/603680 to your computer and use it in GitHub Desktop.
jasmine:ci in Xvfb
$ rake ci:setup:rspec ci:javascripts
(extraneous setup messages elided)
Waiting for jasmine server on 64969...
[2010-10-04 14:37:22] INFO WEBrick 1.3.1
[2010-10-04 14:37:22] INFO ruby 1.8.7 (2010-08-16) [i686-darwin9.8.0]
[2010-10-04 14:37:22] INFO WEBrick::HTTPServer#start: pid=42331 port=64969
Waiting for jasmine server on 64969...
jasmine server started.
Running: java -jar "/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/selenium-rc-2.2.4/vendor/selenium-server.jar" -port 64977 > /dev/null
==> Waiting for Selenium RC server on port 64977... Ready!
Waiting for suite to finish in browser ...
.......................................................................................................................................................................................................................................................................................Expected 'http://www.example.com/foo' to equal 'http://www.example.com/foos'.
Error("Expected 'http://www.example.com/foo' to equal 'http://www.example.com/foos'.")
(Jasmine backtrace elided)
F........................
1)
RuntimeError in 'URL object can substitute arguments for colon-delimited parameters'
Expected 'http://www.example.com/foo' to equal 'http://www.example.com/foos'.
/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/jasmine-1.0.0/lib/jasmine/spec_builder.rb:142:in `report_spec'
/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/jasmine-1.0.0/lib/jasmine/spec_builder.rb:113:in `declare_spec'
Finished in 1.033512 seconds
304 examples, 1 failure
rake aborted!
Command /Users/davidyip/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -I"lib" "/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/rspec-1.3.0/bin/spec" "spec/javascripts/support/jasmine_runner.rb" --require /Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/ci_reporter-1.6.2/lib/ci/reporter/rake/rspec_loader.rb --format CI::Reporter::RSpec failed
(See full trace by running task with --trace)
# For the task that I'm actually using, see revision 7b7553.
# This revision is a little more elegant, but I haven't actually run it.
namespace :ci do
task :javascripts do
display = ':1'
server_pid = fork { exec("Xvfb #{display}") }
ENV['DISPLAY'] = display
begin
Rake::Task['jasmine:ci'].invoke
ensure
Process.kill('TERM', server_pid)
Process.waitall
end
end
end
<?xml version="1.0" encoding="UTF-8"?>
<testsuite failures="0" tests="6" errors="1" skipped="0" name="URL object" time="0.003172">
<testcase name="can substitute arguments for colon-delimited parameters" time="0.002229">
<failure type="RuntimeError" message="Expected 'http://www.example.com/foo' to equal 'http://www.example.com/foos'....">
Expected 'http://www.example.com/foo' to equal 'http://www.example.com/foos'.
(RuntimeError)
/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/jasmine-1.0.0/lib/jasmine/spec_builder.rb:142:in `report_spec'
/Users/davidyip/.rvm/gems/ruby-1.8.7-p302@pathcore/gems/jasmine-1.0.0/lib/jasmine/spec_builder.rb:113:in `declare_spec' </failure>
</testcase>
<testcase name="can append to the query string" time="9.6e-05">
</testcase>
<testcase name="can instantiate many different URLs from the sample template" time="8.6e-05">
</testcase>
<testcase name="does not append a ? if one already exists" time="0.000116">
</testcase>
<testcase name="extracts the parameters from a url" time="9.3e-05">
</testcase>
<testcase name="it returns an empty array when no parameters exist" time="8.7e-05">
</testcase>
<system-out>
</system-out>
<system-err>
</system-err>
</testsuite>
@hannahwhy
Copy link
Author

Things to fix:

  • if :1 isn't available, try additional displays (or, alternatively, just assume Xvfb is always around and fail if that assumption is violated)
  • wait for Xvfb to accept connections before invoking jasmine:ci

@rsutphin
Copy link

rsutphin commented Oct 4, 2010

If the tests fail, is there some way to tell which ones/how?

@hannahwhy
Copy link
Author

Yes. Jasmine's CI runner maps RSpec examples and example groups to Jasmine examples and example groups, respectively, so tools like ci-reporter can capture and report on that data.

I've attached example output of failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment