From 46d102798252aab48a64014e03653553a8274c5d Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 10 Jun 2011 17:14:50 -0400 Subject: [PATCH] fix coffeescript compile error support --- lib/jasmine/files_list.rb | 12 ++++++++++-- spec/bin/jasmine-headless-webkit_spec.rb | 9 +++++++++ .../coffeescript_error/coffeescript_error.yml | 10 ++++++++++ spec/jasmine/coffeescript_error/spec.coffee | 2 ++ spec/jasmine/coffeescript_error/src.coffee | 2 ++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 spec/jasmine/coffeescript_error/coffeescript_error.yml create mode 100644 spec/jasmine/coffeescript_error/spec.coffee create mode 100644 spec/jasmine/coffeescript_error/src.coffee diff --git a/lib/jasmine/files_list.rb b/lib/jasmine/files_list.rb index f0cb693..d75c52f 100644 --- a/lib/jasmine/files_list.rb +++ b/lib/jasmine/files_list.rb @@ -71,8 +71,16 @@ module Jasmine %{} rescue CoffeeScript::CompilationError => e - puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), e.message.to_s.color(:white) ] - exit 1 + files.each do |file| + begin + CoffeeScript.compile(fh = File.open(file)) + rescue CoffeeScript::CompilationError => ne + puts "[%s] %s: %s" % [ 'coffeescript'.color(:red), file.color(:yellow), ne.message.to_s.color(:white) ] + exit 1 + ensure + fh.close + end + end ensure files.clear end diff --git a/spec/bin/jasmine-headless-webkit_spec.rb b/spec/bin/jasmine-headless-webkit_spec.rb index c1a10fc..b2ff9a5 100644 --- a/spec/bin/jasmine-headless-webkit_spec.rb +++ b/spec/bin/jasmine-headless-webkit_spec.rb @@ -64,6 +64,15 @@ describe "jasmine-headless-webkit" do end end + describe 'with coffeescript error' do + it "should fail" do + system %{bin/jasmine-headless-webkit -j spec/jasmine/coffeescript_error/coffeescript_error.yml --report #{report}} + $?.exitstatus.should == 1 + + File.exist?(report).should be_false + end + end + describe 'with filtered run' do context "don't run a full run, just the filtered run" do it "should succeed and run both" do diff --git a/spec/jasmine/coffeescript_error/coffeescript_error.yml b/spec/jasmine/coffeescript_error/coffeescript_error.yml new file mode 100644 index 0000000..07551a8 --- /dev/null +++ b/spec/jasmine/coffeescript_error/coffeescript_error.yml @@ -0,0 +1,10 @@ + +src_files: + - spec/jasmine/coffeescript_error/src.coffee + +spec_files: + - spec/jasmine/coffeescript_error/spec.coffee + +src_dir: . +spec_dir: . + diff --git a/spec/jasmine/coffeescript_error/spec.coffee b/spec/jasmine/coffeescript_error/spec.coffee new file mode 100644 index 0000000..c431477 --- /dev/null +++ b/spec/jasmine/coffeescript_error/spec.coffee @@ -0,0 +1,2 @@ +if + diff --git a/spec/jasmine/coffeescript_error/src.coffee b/spec/jasmine/coffeescript_error/src.coffee new file mode 100644 index 0000000..38214ba --- /dev/null +++ b/spec/jasmine/coffeescript_error/src.coffee @@ -0,0 +1,2 @@ +a = "1" +