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 +1 -0
- data/Guardfile +2 -0
- data/Rakefile +30 -0
- data/ext/jasmine-webkit-specrunner/specrunner.cpp +22 -16
- data/jasmine-headless-webkit.gemspec +1 -1
- data/lib/jasmine-headless-webkit/version.rb +1 -1
- data/lib/jasmine/cli.rb +5 -1
- data/spec/bin/jasmine-headless-webkit_spec.rb +14 -0
- data/spec/jasmine/success_with_error/success_with_error.js +3 -0
- data/spec/jasmine/success_with_error/success_with_error.yml +9 -0
- data/spec/jasmine/success_with_error/success_with_error_spec.js +6 -0
- data/spec/lib/jasmine/cli_spec.rb +2 -2
- metadata +11 -6
- data/coffee.watchr +0 -18
data/Gemfile
CHANGED
data/Guardfile
CHANGED
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 (
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
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
|
-
|
298
|
-
|
299
|
-
|
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
|
|
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) {
|
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}}
|
@@ -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.
|
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-
|
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: "
|
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:
|
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:
|
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
|
-
|