jasmine / jasmine-gem

Jasmine ruby gem
682 stars 274 forks source link

LocalJumpError on failing test in `rake jasmine:ci` #223

Closed davidbalbert closed 10 years ago

davidbalbert commented 10 years ago

If you have a failing test and you run rake jasmine:ci, you get the following output:

          Expected false
 to be equal to true
          Error: Expected false
 to be equal to true
    at stack (http://localhost:33071/__jasmine__/jasmine.js:1293)
    at buildExpectationResult (http://localhost:33071/__jasmine__/jasmine.js:1270)
    at http://localhost:33071/__jasmine__/jasmine.js:484
    at http://localhost:33071/__jasmine__/jasmine.js:260
11 specs, 1 failure
rake aborted!
LocalJumpError: break from proc-closure
/home/travis/build/hackerschool/community/vendor/bundle/ruby/2.1.0/gems/jasmine-2.0.2/lib/jasmine/tasks/jasmine.rake:70:in `block (2 levels) in <top (required)>'
/home/travis/build/hackerschool/community/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
/home/travis/build/hackerschool/community/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
/home/travis/build/hackerschool/community/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/travis/build/hackerschool/community/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
Tasks: TOP => jasmine:ci
(See full trace by running task with --trace)

This is because the jasmine:ci task has a break in it's body, which isn't allowed if the block gets called outside of the task method, which it does.

Someone made a comment on the commit, but it was unanswered: https://github.com/pivotal/jasmine-gem/commit/2106d95fd622f19120f4116efe38c91706c3d20e#commitcomment-6118710.

Would it be possible to quietly exit with status 1 instead of printing this unrelated error?

ragaskar commented 10 years ago

My understanding was that calling exit every time would break chained rake tasks, so it looks like the fix we had here was to call break instead every time.

I think the right fix is to only call exit if we fail. Happy to take a pull request fixing this.

krisleech commented 10 years ago

Any chance of a new gem version so we can get this fix?