jasmine-headless-webkit 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -8,5 +8,6 @@ gem 'fakefs', :require => nil
8
8
  gem 'guard'
9
9
  gem 'guard-rspec'
10
10
  gem 'guard-shell'
11
+ gem 'guard-coffeescript'
11
12
  gem 'growl'
12
13
  gem 'rake', '0.8.7'
data/Guardfile CHANGED
@@ -21,3 +21,5 @@ def compile
21
21
  end
22
22
 
23
23
  compile
24
+
25
+ guard 'coffeescript', :input => 'jasmine'
data/Rakefile CHANGED
@@ -1,2 +1,32 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ namespace :spec do
9
+ desc "Run on three Rubies"
10
+ task :platforms do
11
+ current = %x{rvm-prompt v}
12
+
13
+ fail = false
14
+ %w{1.8.7 1.9.2 ree}.each do |version|
15
+ puts "Switching to #{version}"
16
+ Bundler.with_clean_env do
17
+ system %{bash -c 'source ~/.rvm/scripts/rvm ; rvm #{version} ; bundle install ; bundle exec rake spec'}
18
+ end
19
+ if $?.exitstatus != 0
20
+ fail = true
21
+ break
22
+ end
23
+ end
24
+
25
+ system %{rvm #{current}}
26
+
27
+ exit (fail ? 1 : 0)
28
+ end
29
+ end
30
+
31
+ task :default => 'spec:platforms'
32
+
@@ -221,6 +221,8 @@ void HeadlessSpecRunner::log(const QString &msg)
221
221
  }
222
222
  std::cout << "[console] ";
223
223
  clear();
224
+ if (msg.contains("\n"))
225
+ std::cout << std::endl;
224
226
  std::cout << qPrintable(msg);
225
227
  std::cout << std::endl;
226
228
  }
@@ -248,7 +250,13 @@ void HeadlessSpecRunner::finishSuite(const QString &duration, const QString &tot
248
250
  std::cout << "FAIL: ";
249
251
  } else {
250
252
  green();
251
- std::cout << "PASS: ";
253
+ std::cout << "PASS";
254
+
255
+ if (hasErrors) {
256
+ std::cout << " with JS errors";
257
+ }
258
+
259
+ std::cout << ": ";
252
260
  }
253
261
 
254
262
  std::cout << qPrintable(total) << " tests, " << qPrintable(failed) << " failures, " << qPrintable(duration) << " secs.";
@@ -280,24 +288,22 @@ void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
280
288
  if (hasErrors && m_runs > 2)
281
289
  QApplication::instance()->exit(1);
282
290
 
283
- if (!hasErrors) {
284
- if (isFinished) {
285
- int exitCode = 0;
286
- if (didFail) {
287
- exitCode = 1;
288
- } else {
289
- if (usedConsole) {
290
- exitCode = 2;
291
- }
291
+ if (isFinished) {
292
+ int exitCode = 0;
293
+ if (didFail || hasErrors) {
294
+ exitCode = 1;
295
+ } else {
296
+ if (usedConsole) {
297
+ exitCode = 2;
292
298
  }
293
-
294
- QApplication::instance()->exit(exitCode);
295
299
  }
296
300
 
297
- if (m_runs > 30) {
298
- std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl;
299
- QApplication::instance()->exit(1);
300
- }
301
+ QApplication::instance()->exit(exitCode);
302
+ }
303
+
304
+ if (m_runs > 30) {
305
+ std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl;
306
+ QApplication::instance()->exit(1);
301
307
  }
302
308
  }
303
309
 
@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
 
23
23
  s.add_dependency 'jasmine'
24
- s.add_dependency 'coffee-script'
24
+ s.add_dependency 'coffee-script', '>= 2.2'
25
25
  s.add_dependency 'rainbow'
26
26
  end
@@ -1,7 +1,7 @@
1
1
  module Jasmine
2
2
  module Headless
3
3
  module Webkit
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
6
6
  end
7
7
  end
data/lib/jasmine/cli.rb CHANGED
@@ -36,7 +36,11 @@ module Jasmine
36
36
  <head>
37
37
  <title>Jasmine Test Runner</title>
38
38
  <script type="text/javascript">
39
- window.console = { log: function(data) { JHW.log(JSON.stringify(data)); } };
39
+ window.console = { log: function(data) {
40
+ JHW.log(JSON.stringify(data));
41
+ }, pp: function(data) {
42
+ JHW.log(jasmine ? jasmine.pp(data) : JSON.stringify(data));
43
+ } };
40
44
  </script>
41
45
  #{files.join("\n")}
42
46
  </head>
@@ -24,6 +24,20 @@ describe "jasmine-headless-webkit" do
24
24
  end
25
25
  end
26
26
 
27
+
28
+ describe 'success but with js error' do
29
+ it "should succeed with error code 0" do
30
+ system %{bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml --report #{report}}
31
+ $?.exitstatus.should == 1
32
+
33
+ parts = File.read(report).strip.split('/')
34
+ parts.length.should == 4
35
+ parts[0].should == "1"
36
+ parts[1].should == "0"
37
+ parts[2].should == "F"
38
+ end
39
+ end
40
+
27
41
  describe 'failure' do
28
42
  it "should fail with an error code of 1" do
29
43
  system %{bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml --report #{report}}
@@ -0,0 +1,3 @@
1
+ var good = 2;
2
+ var bad = null;
3
+ if (bad.myProperty) {}
@@ -0,0 +1,9 @@
1
+ src_files:
2
+ - spec/jasmine/success_with_error/success_with_error.js
3
+
4
+ spec_files:
5
+ - spec/jasmine/success_with_error/success_with_error_spec.js
6
+
7
+ src_dir: .
8
+ spec_dir: .
9
+
@@ -0,0 +1,6 @@
1
+ describe('Success with error', function() {
2
+ it("should not fail", function() {
3
+ expect(good).toEqual(2);
4
+ })
5
+ });
6
+
@@ -45,8 +45,8 @@ describe Jasmine::CLI do
45
45
  let(:test_data) { %w{third fourth} }
46
46
 
47
47
  before do
48
- File.open(GLOBAL_DEFAULTS_FILE, 'w') { |fh| fh.puts global_test_data.join(' ') }
49
- File.open(DEFAULTS_FILE, 'w') { |fh| fh.puts test_data.join(' ') }
48
+ File.open(Jasmine::CLI::GLOBAL_DEFAULTS_FILE, 'w') { |fh| fh.puts global_test_data.join(' ') }
49
+ File.open(Jasmine::CLI::DEFAULTS_FILE, 'w') { |fh| fh.puts test_data.join(' ') }
50
50
  end
51
51
 
52
52
  it "should read the options" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jasmine-headless-webkit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Bintz
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-05-29 00:00:00 -04:00
15
+ date: 2011-06-08 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  requirements:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: "0"
36
+ version: "2.2"
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: *id002
@@ -67,7 +67,6 @@ files:
67
67
  - README.md
68
68
  - Rakefile
69
69
  - bin/jasmine-headless-webkit
70
- - coffee.watchr
71
70
  - ext/jasmine-webkit-specrunner/Info.plist
72
71
  - ext/jasmine-webkit-specrunner/extconf.rb
73
72
  - ext/jasmine-webkit-specrunner/specrunner.cpp
@@ -94,6 +93,9 @@ files:
94
93
  - spec/jasmine/success/success.js
95
94
  - spec/jasmine/success/success.yml
96
95
  - spec/jasmine/success/success_spec.js
96
+ - spec/jasmine/success_with_error/success_with_error.js
97
+ - spec/jasmine/success_with_error/success_with_error.yml
98
+ - spec/jasmine/success_with_error/success_with_error_spec.js
97
99
  - spec/lib/jasmine/cli_spec.rb
98
100
  - spec/spec_helper.rb
99
101
  has_rdoc: true
@@ -110,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
112
  requirements:
111
113
  - - ">="
112
114
  - !ruby/object:Gem::Version
113
- hash: -221398851887146257
115
+ hash: 1748580406864593644
114
116
  segments:
115
117
  - 0
116
118
  version: "0"
@@ -119,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
121
  requirements:
120
122
  - - ">="
121
123
  - !ruby/object:Gem::Version
122
- hash: -221398851887146257
124
+ hash: 1748580406864593644
123
125
  segments:
124
126
  - 0
125
127
  version: "0"
@@ -141,5 +143,8 @@ test_files:
141
143
  - spec/jasmine/success/success.js
142
144
  - spec/jasmine/success/success.yml
143
145
  - spec/jasmine/success/success_spec.js
146
+ - spec/jasmine/success_with_error/success_with_error.js
147
+ - spec/jasmine/success_with_error/success_with_error.yml
148
+ - spec/jasmine/success_with_error/success_with_error_spec.js
144
149
  - spec/lib/jasmine/cli_spec.rb
145
150
  - spec/spec_helper.rb
data/coffee.watchr DELETED
@@ -1,18 +0,0 @@
1
- require 'coffee-script'
2
-
3
- FILE = 'jasmine/jasmine.headless-reporter.coffee' if !self.class.const_defined?(:FILE)
4
- TARGET = FILE.gsub('.coffee', '.js') if !self.class.const_defined?(:TARGET)
5
-
6
- watch(FILE) { coffee }
7
-
8
- def coffee
9
- begin
10
- File.open(TARGET, 'w') { |fh| fh.print CoffeeScript.compile File.open(FILE) }
11
- puts "Wrote #{TARGET}"
12
- rescue Exception => e
13
- puts e.message
14
- end
15
- end
16
-
17
- coffee
18
-