guard-jasmine 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/lib/guard/jasmine.rb +9 -7
- data/lib/guard/jasmine/runner.rb +9 -5
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -136,6 +136,9 @@ There following options can be passed to Guard::Jasmine:
|
|
136
136
|
:hide_success => true # Disable successful compilation messages.
|
137
137
|
# default: false
|
138
138
|
|
139
|
+
:max_error_notify => 5 # Maximum error notifications to show.
|
140
|
+
# default: 3
|
141
|
+
|
139
142
|
The `:keep_failed` failed option remembers failed suites and not failed specs. The reason for this decision is to
|
140
143
|
avoid to much round trip time to request the Jasmine test runner for each single spec, which is mostly more expensive
|
141
144
|
than running a whole suite.
|
data/lib/guard/jasmine.rb
CHANGED
@@ -24,19 +24,21 @@ module Guard
|
|
24
24
|
# @option options [String] :phantomjs_bin the location of the PhantomJS binary
|
25
25
|
# @option options [Boolean] :notification show notifications
|
26
26
|
# @option options [Boolean] :hide_success hide success message notification
|
27
|
+
# @option options [Integer] :max_error_notify maximum error notifications to show
|
27
28
|
# @option options [Boolean] :all_on_start run all suites on start
|
28
29
|
# @option options [Boolean] :keep_failed keep failed suites and add them to the next run again
|
29
30
|
# @option options [Boolean] :all_after_pass run all suites after a suite has passed again after failing
|
30
31
|
#
|
31
32
|
def initialize(watchers = [], options = { })
|
32
33
|
defaults = {
|
33
|
-
:jasmine_url
|
34
|
-
:phantomjs_bin
|
35
|
-
:notification
|
36
|
-
:hide_success
|
37
|
-
:all_on_start
|
38
|
-
:keep_failed
|
39
|
-
:all_after_pass
|
34
|
+
:jasmine_url => 'http://localhost:3000/jasmine',
|
35
|
+
:phantomjs_bin => '/usr/local/bin/phantomjs',
|
36
|
+
:notification => true,
|
37
|
+
:hide_success => false,
|
38
|
+
:all_on_start => true,
|
39
|
+
:keep_failed => true,
|
40
|
+
:all_after_pass => true,
|
41
|
+
:max_error_notify => 3
|
40
42
|
}
|
41
43
|
|
42
44
|
super(watchers, defaults.merge(options))
|
data/lib/guard/jasmine/runner.rb
CHANGED
@@ -20,6 +20,7 @@ module Guard
|
|
20
20
|
# @option options [String] :phantomjs_bin the location of the PhantomJS binary
|
21
21
|
# @option options [Boolean] :notification show notifications
|
22
22
|
# @option options [Boolean] :hide_success hide success message notification
|
23
|
+
# @option options [Integer] :max_error_notify maximum error notifications to show
|
23
24
|
# @return [Boolean, Array<String>] the status of the run and the failed files
|
24
25
|
#
|
25
26
|
def run(paths, options = { })
|
@@ -205,22 +206,25 @@ module Guard
|
|
205
206
|
#
|
206
207
|
# @param [Hash] result the suite result
|
207
208
|
# @param [String] stats the status information
|
209
|
+
# @option options [Integer] :max_error_notify maximum error notifications to show
|
208
210
|
# @option options [Boolean] :hide_success hide success message notification
|
209
211
|
#
|
210
212
|
def notify_specdoc(result, stats, options)
|
211
213
|
result['suites'].each do |suite|
|
212
214
|
Formatter.suite_name("➥ #{ suite['description'] }")
|
213
215
|
|
214
|
-
suite['specs'].
|
216
|
+
suite['specs'].each_with_index do |spec, index|
|
215
217
|
if spec['passed']
|
216
218
|
Formatter.success(" ✔ #{ spec['description'] }") if !options[:hide_success]
|
217
219
|
else
|
218
220
|
Formatter.spec_failed(" ✘ #{ spec['description'] }")
|
219
221
|
Formatter.spec_failed(" ➤ #{ format_error_message(spec['error_message'], false) }")
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
222
|
+
if options[:max_error_notify] > index
|
223
|
+
Formatter.notify("#{ spec['description'] }: #{ format_error_message(spec['error_message'], true) }",
|
224
|
+
:title => 'Jasmine spec failed',
|
225
|
+
:image => :failed,
|
226
|
+
:priority => 2) if options[:notification]
|
227
|
+
end
|
224
228
|
end
|
225
229
|
end
|
226
230
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Kessler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: guard
|