jasmine 3.2.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/.travis.yml +13 -4
- data/Gemfile +3 -5
- data/README.markdown +58 -11
- data/jasmine.gemspec +5 -3
- data/lib/jasmine.rb +1 -0
- data/lib/jasmine/asset_expander.rb +20 -4
- data/lib/jasmine/ci_runner.rb +17 -2
- data/lib/jasmine/config.rb +17 -7
- data/lib/jasmine/configuration.rb +10 -0
- data/lib/jasmine/dependencies.rb +8 -2
- data/lib/jasmine/formatters/console.rb +26 -6
- data/lib/jasmine/runners/chrome_headless.rb +126 -0
- data/lib/jasmine/runners/chromeheadless_boot.js +15 -0
- data/lib/jasmine/tasks/jasmine.rake +5 -1
- data/lib/jasmine/version.rb +1 -1
- data/release_notes/3.3.0.md +19 -0
- data/release_notes/3.4.0.md +17 -0
- data/release_notes/3.5.0.md +16 -0
- data/release_notes/3.5.1.md +18 -0
- data/release_notes/3.6.0.md +31 -0
- data/spec/chrome_headless_spec.rb +50 -0
- data/spec/ci_runner_spec.rb +143 -0
- data/spec/configuration_spec.rb +13 -0
- data/spec/jasmine_rails_spec.rb +168 -113
- data/spec/lib/jasmine/formatters/console_spec.rb +54 -20
- data/spec/spec_helper.rb +21 -0
- metadata +24 -9
@@ -13,28 +13,28 @@ describe Jasmine::Formatters::Console do
|
|
13
13
|
|
14
14
|
describe '#format' do
|
15
15
|
it 'prints a dot for a successful spec' do
|
16
|
-
formatter = Jasmine::Formatters::Console.new(outputter)
|
16
|
+
formatter = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
17
17
|
formatter.format([passing_result])
|
18
18
|
|
19
19
|
expect(outputter_output).to include('.')
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'prints a star for a pending spec' do
|
23
|
-
formatter = Jasmine::Formatters::Console.new(outputter)
|
23
|
+
formatter = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
24
24
|
formatter.format([pending_result])
|
25
25
|
|
26
26
|
expect(outputter_output).to include('*')
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'prints an F for a failing spec' do
|
30
|
-
formatter = Jasmine::Formatters::Console.new(outputter)
|
30
|
+
formatter = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
31
31
|
formatter.format([failing_result])
|
32
32
|
|
33
33
|
expect(outputter_output).to include('F')
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'prints a dot for a disabled spec' do
|
37
|
-
formatter = Jasmine::Formatters::Console.new(outputter)
|
37
|
+
formatter = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
38
38
|
formatter.format([disabled_result])
|
39
39
|
|
40
40
|
expect(outputter_output).to eq('')
|
@@ -44,7 +44,7 @@ describe Jasmine::Formatters::Console do
|
|
44
44
|
describe '#summary' do
|
45
45
|
it 'shows the failure messages' do
|
46
46
|
results = [failing_result, failing_result]
|
47
|
-
formatter = Jasmine::Formatters::Console.new(outputter)
|
47
|
+
formatter = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
48
48
|
formatter.format(results)
|
49
49
|
formatter.done(run_details)
|
50
50
|
expect(outputter_output).to match(/a suite with a failing spec/)
|
@@ -55,7 +55,7 @@ describe Jasmine::Formatters::Console do
|
|
55
55
|
describe 'when the full suite passes' do
|
56
56
|
it 'shows the spec counts' do
|
57
57
|
results = [passing_result]
|
58
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
58
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
59
59
|
console.format(results)
|
60
60
|
console.done(run_details)
|
61
61
|
|
@@ -65,7 +65,7 @@ describe Jasmine::Formatters::Console do
|
|
65
65
|
|
66
66
|
it 'shows the spec counts (pluralized)' do
|
67
67
|
results = [passing_result, passing_result]
|
68
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
68
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
69
69
|
console.format(results)
|
70
70
|
console.done(run_details)
|
71
71
|
|
@@ -77,7 +77,7 @@ describe Jasmine::Formatters::Console do
|
|
77
77
|
describe 'when there are failures' do
|
78
78
|
it 'shows the spec counts' do
|
79
79
|
results = [passing_result, failing_result]
|
80
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
80
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
81
81
|
console.format(results)
|
82
82
|
console.done(run_details)
|
83
83
|
|
@@ -87,7 +87,7 @@ describe Jasmine::Formatters::Console do
|
|
87
87
|
|
88
88
|
it 'shows the spec counts (pluralized)' do
|
89
89
|
results = [failing_result, failing_result]
|
90
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
90
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
91
91
|
console.format(results)
|
92
92
|
console.done(run_details)
|
93
93
|
|
@@ -97,7 +97,7 @@ describe Jasmine::Formatters::Console do
|
|
97
97
|
|
98
98
|
it 'shows the failure message' do
|
99
99
|
results = [failing_result]
|
100
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
100
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
101
101
|
console.format(results)
|
102
102
|
console.done(run_details)
|
103
103
|
|
@@ -108,7 +108,7 @@ describe Jasmine::Formatters::Console do
|
|
108
108
|
describe 'when there are pending specs' do
|
109
109
|
it 'shows the spec counts' do
|
110
110
|
results = [passing_result, pending_result]
|
111
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
111
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
112
112
|
console.format(results)
|
113
113
|
console.done(run_details)
|
114
114
|
|
@@ -117,7 +117,7 @@ describe Jasmine::Formatters::Console do
|
|
117
117
|
|
118
118
|
it 'shows the spec counts (pluralized)' do
|
119
119
|
results = [pending_result, pending_result]
|
120
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
120
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
121
121
|
console.format(results)
|
122
122
|
console.done(run_details)
|
123
123
|
|
@@ -126,7 +126,7 @@ describe Jasmine::Formatters::Console do
|
|
126
126
|
|
127
127
|
it 'shows the pending reason' do
|
128
128
|
results = [pending_result]
|
129
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
129
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
130
130
|
console.format(results)
|
131
131
|
console.done(run_details)
|
132
132
|
|
@@ -135,7 +135,7 @@ describe Jasmine::Formatters::Console do
|
|
135
135
|
|
136
136
|
it 'shows the default pending reason' do
|
137
137
|
results = [Jasmine::Result.new(pending_raw_result.merge('pendingReason' => ''))]
|
138
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
138
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
139
139
|
console.format(results)
|
140
140
|
console.done(run_details)
|
141
141
|
|
@@ -147,7 +147,7 @@ describe Jasmine::Formatters::Console do
|
|
147
147
|
|
148
148
|
it 'should not mention pending specs' do
|
149
149
|
results = [passing_result]
|
150
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
150
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
151
151
|
console.format(results)
|
152
152
|
console.done(run_details)
|
153
153
|
|
@@ -158,7 +158,7 @@ describe Jasmine::Formatters::Console do
|
|
158
158
|
describe 'when the tests were randomized' do
|
159
159
|
it 'should print a message with the seed' do
|
160
160
|
results = [passing_result]
|
161
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
161
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
162
162
|
console.format(results)
|
163
163
|
console.done({ 'order' => { 'random' => true, 'seed' => '4325' } })
|
164
164
|
|
@@ -168,7 +168,7 @@ describe Jasmine::Formatters::Console do
|
|
168
168
|
|
169
169
|
describe 'with loading errors' do
|
170
170
|
it 'should show the errors' do
|
171
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
171
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
172
172
|
console.done({ 'failedExpectations' => [
|
173
173
|
{
|
174
174
|
'globalErrorType' => 'load',
|
@@ -190,7 +190,7 @@ describe Jasmine::Formatters::Console do
|
|
190
190
|
|
191
191
|
describe 'with errors in a global afterAll' do
|
192
192
|
it 'should show the errors' do
|
193
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
193
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
194
194
|
console.done({ 'failedExpectations' => [
|
195
195
|
{
|
196
196
|
'globalErrorType' => 'afterAll',
|
@@ -212,7 +212,7 @@ describe Jasmine::Formatters::Console do
|
|
212
212
|
|
213
213
|
describe 'when the overall status is incomplete' do
|
214
214
|
it 'shows the reason' do
|
215
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
215
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
216
216
|
console.done({
|
217
217
|
'overallStatus' => 'incomplete',
|
218
218
|
'incompleteReason' => 'not all bars were frobnicated'
|
@@ -223,7 +223,7 @@ describe Jasmine::Formatters::Console do
|
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'shows deprecation warnings' do
|
226
|
-
console = Jasmine::Formatters::Console.new(outputter)
|
226
|
+
console = Jasmine::Formatters::Console.new(double(:config, color: true), outputter)
|
227
227
|
console.format([Jasmine::Result.new(deprecation_raw_result)])
|
228
228
|
console.done({ 'deprecationWarnings' => [{ 'message' => 'globally deprecated', 'stack' => nil }] })
|
229
229
|
|
@@ -232,6 +232,40 @@ describe Jasmine::Formatters::Console do
|
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
+
describe 'enabling and disabling colorized output' do
|
236
|
+
context '.color_enabled controls whether it outputs with color or not' do
|
237
|
+
it 'prints colored outputs' do
|
238
|
+
config = double(:config, color: true)
|
239
|
+
|
240
|
+
formatter = Jasmine::Formatters::Console.new(config, outputter)
|
241
|
+
formatter.format([passing_result])
|
242
|
+
formatter.format([failing_result])
|
243
|
+
formatter.format([pending_result])
|
244
|
+
formatter.done(run_details)
|
245
|
+
|
246
|
+
expect(outputter_output).to include("\e[31m")
|
247
|
+
expect(outputter_output).to include("\e[32m")
|
248
|
+
expect(outputter_output).to include("\e[33m")
|
249
|
+
expect(outputter_output).to include("\e[0m")
|
250
|
+
end
|
251
|
+
|
252
|
+
it "doesn't print colored outputs" do
|
253
|
+
config = double(:config, color: false)
|
254
|
+
|
255
|
+
formatter = Jasmine::Formatters::Console.new(config, outputter)
|
256
|
+
formatter.format([passing_result])
|
257
|
+
formatter.format([failing_result])
|
258
|
+
formatter.format([pending_result])
|
259
|
+
formatter.done(run_details)
|
260
|
+
|
261
|
+
expect(outputter_output).not_to include("\e[31m")
|
262
|
+
expect(outputter_output).not_to include("\e[32m")
|
263
|
+
expect(outputter_output).not_to include("\e[33m")
|
264
|
+
expect(outputter_output).not_to include("\e[0m")
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
235
269
|
def failing_result
|
236
270
|
Jasmine::Result.new(failing_raw_result)
|
237
271
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -21,6 +21,27 @@ rescue Gem::LoadError
|
|
21
21
|
false
|
22
22
|
end
|
23
23
|
|
24
|
+
def rails_version
|
25
|
+
if ENV['RAILS_VERSION']
|
26
|
+
ENV['RAILS_VERSION']
|
27
|
+
else
|
28
|
+
'rails6' # keep in sync with default in gemspec
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def ruby_at_least?(version_str)
|
33
|
+
desired = version_str.split('.').map(&:to_i)
|
34
|
+
actual = RUBY_VERSION.split('.').map(&:to_i)
|
35
|
+
|
36
|
+
desired.zip(actual).each do |(d, a)|
|
37
|
+
if d != a
|
38
|
+
return d <= a
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
24
45
|
def create_temp_dir
|
25
46
|
tmp = File.join(Dir.tmpdir, "jasmine-gem-test_#{Time.now.to_f}")
|
26
47
|
FileUtils.rm_r(tmp, :force => true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Van Hove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 7.0.0
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '6'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 7.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rack-test
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +90,16 @@ dependencies:
|
|
84
90
|
name: jasmine-core
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- -
|
93
|
+
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
95
|
+
version: 3.6.0
|
90
96
|
type: :runtime
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- -
|
100
|
+
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
102
|
+
version: 3.6.0
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rack
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,6 +195,8 @@ files:
|
|
189
195
|
- lib/jasmine/result.rb
|
190
196
|
- lib/jasmine/ruby_versions.rb
|
191
197
|
- lib/jasmine/run.html.erb
|
198
|
+
- lib/jasmine/runners/chrome_headless.rb
|
199
|
+
- lib/jasmine/runners/chromeheadless_boot.js
|
192
200
|
- lib/jasmine/runners/phantom_boot.js
|
193
201
|
- lib/jasmine/runners/phantom_jasmine_run.js
|
194
202
|
- lib/jasmine/runners/phantom_js.rb
|
@@ -203,6 +211,11 @@ files:
|
|
203
211
|
- release_notes/3.0.md
|
204
212
|
- release_notes/3.1.0.md
|
205
213
|
- release_notes/3.2.0.md
|
214
|
+
- release_notes/3.3.0.md
|
215
|
+
- release_notes/3.4.0.md
|
216
|
+
- release_notes/3.5.0.md
|
217
|
+
- release_notes/3.5.1.md
|
218
|
+
- release_notes/3.6.0.md
|
206
219
|
- release_notes/v1.2.1.md
|
207
220
|
- release_notes/v1.3.2.md
|
208
221
|
- release_notes/v2.0.0.md
|
@@ -226,6 +239,7 @@ files:
|
|
226
239
|
- spec/application_integration_spec.rb
|
227
240
|
- spec/application_spec.rb
|
228
241
|
- spec/base_spec.rb
|
242
|
+
- spec/chrome_headless_spec.rb
|
229
243
|
- spec/ci_runner_spec.rb
|
230
244
|
- spec/configuration_spec.rb
|
231
245
|
- spec/fixture/Rakefile
|
@@ -277,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
291
|
version: '0'
|
278
292
|
requirements: []
|
279
293
|
rubyforge_project:
|
280
|
-
rubygems_version: 2.6.
|
294
|
+
rubygems_version: 2.7.6.2
|
281
295
|
signing_key:
|
282
296
|
specification_version: 4
|
283
297
|
summary: JavaScript BDD framework
|
@@ -285,6 +299,7 @@ test_files:
|
|
285
299
|
- spec/application_integration_spec.rb
|
286
300
|
- spec/application_spec.rb
|
287
301
|
- spec/base_spec.rb
|
302
|
+
- spec/chrome_headless_spec.rb
|
288
303
|
- spec/ci_runner_spec.rb
|
289
304
|
- spec/configuration_spec.rb
|
290
305
|
- spec/fixture/Rakefile
|