guard-jasmine 2.0.1 → 2.0.2
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.
- checksums.yaml +4 -4
- data/lib/guard/jasmine/cli.rb +3 -3
- data/lib/guard/jasmine/formatter.rb +12 -10
- data/lib/guard/jasmine/inspector.rb +3 -1
- data/lib/guard/jasmine/phantomjs/guard-jasmine.js +7 -2
- data/lib/guard/jasmine/phantomjs/src/guard-jasmine.coffee +6 -2
- data/lib/guard/jasmine/runner.rb +4 -1
- data/lib/guard/jasmine/server.rb +16 -14
- data/lib/guard/jasmine/util.rb +2 -1
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +4 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12caddb0c39fa9e9eb322b6c951c89852701f973
|
4
|
+
data.tar.gz: f0cf28ed90b43983707498f0687bda3c13eae5b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e289b661a2d079a9da870b108afea5c1c3edb1da7e075ec09acfa000bd2ee25a5ef0b59f89a86b4e8e465d6da2765c38c2f16fb635f5798e548ea158c800696
|
7
|
+
data.tar.gz: 2399a04e13a740d2e1eaf8a4cf0452d16f6ccf37074a099449cca08c75a48a8d4c73eb7967250f26017d451b9e0c2e1857b9dffe6197a01f6535b3b9bd751cb5
|
data/lib/guard/jasmine/cli.rb
CHANGED
@@ -7,7 +7,7 @@ require 'guard/jasmine/util'
|
|
7
7
|
require 'guard/jasmine/server'
|
8
8
|
|
9
9
|
module Guard
|
10
|
-
class Jasmine
|
10
|
+
class Jasmine < Plugin
|
11
11
|
# Small helper class to run the Jasmine runner_options once from the
|
12
12
|
# command line. This can be useful to integrate guard-jasmine
|
13
13
|
# into a continuous integration server.
|
@@ -225,7 +225,7 @@ module Guard
|
|
225
225
|
end
|
226
226
|
|
227
227
|
rescue => e
|
228
|
-
::
|
228
|
+
Compat::UI.error "Something went wrong: #{e.message}"
|
229
229
|
Process.exit 2
|
230
230
|
ensure
|
231
231
|
::Guard::Jasmine::Server.stop
|
@@ -239,7 +239,7 @@ module Guard
|
|
239
239
|
# @see Guard::Jasmine::VERSION
|
240
240
|
#
|
241
241
|
def version
|
242
|
-
::
|
242
|
+
Compat::UI.info "Guard::Jasmine version #{ ::Guard::JasmineVersion::VERSION }"
|
243
243
|
end
|
244
244
|
end
|
245
245
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'guard/compat/plugin'
|
2
|
+
|
1
3
|
module Guard
|
2
|
-
class Jasmine
|
4
|
+
class Jasmine < Plugin
|
3
5
|
# The Guard::Jasmine formatter collects console and
|
4
6
|
# system notification methods and enhances them with
|
5
7
|
# some color information.
|
@@ -13,7 +15,7 @@ module Guard
|
|
13
15
|
# @option options [Boolean] :reset reset the UI
|
14
16
|
#
|
15
17
|
def info(message, options = {})
|
16
|
-
::
|
18
|
+
Compat::UI.info(message, options)
|
17
19
|
end
|
18
20
|
|
19
21
|
# Print a debug message to the console.
|
@@ -23,7 +25,7 @@ module Guard
|
|
23
25
|
# @option options [Boolean] :reset reset the UI
|
24
26
|
#
|
25
27
|
def debug(message, options = {})
|
26
|
-
::
|
28
|
+
Compat::UI.debug(message, options)
|
27
29
|
end
|
28
30
|
|
29
31
|
# Print a red error message to the console.
|
@@ -33,7 +35,7 @@ module Guard
|
|
33
35
|
# @option options [Boolean] :reset reset the UI
|
34
36
|
#
|
35
37
|
def error(message, options = {})
|
36
|
-
::
|
38
|
+
Compat::UI.error(color(message, ';31'), options)
|
37
39
|
end
|
38
40
|
|
39
41
|
# Print a green success message to the console.
|
@@ -43,7 +45,7 @@ module Guard
|
|
43
45
|
# @option options [Boolean] :reset reset the UI
|
44
46
|
#
|
45
47
|
def success(message, options = {})
|
46
|
-
::
|
48
|
+
Compat::UI.info(color(message, ';32'), options)
|
47
49
|
end
|
48
50
|
|
49
51
|
# Print a yellow pending message to the console.
|
@@ -53,7 +55,7 @@ module Guard
|
|
53
55
|
# @option options [Boolean] :reset reset the UI
|
54
56
|
#
|
55
57
|
def spec_pending(message, options = {})
|
56
|
-
::
|
58
|
+
Compat::UI.info(color(message, ';33'), options)
|
57
59
|
end
|
58
60
|
|
59
61
|
# Print a red spec failed message to the console.
|
@@ -62,7 +64,7 @@ module Guard
|
|
62
64
|
# @param [Hash] options the output options
|
63
65
|
#
|
64
66
|
def spec_failed(message, options = {})
|
65
|
-
::
|
67
|
+
Compat::UI.info(color(message, ';31'), options)
|
66
68
|
end
|
67
69
|
|
68
70
|
# Print a red spec failed message to the console.
|
@@ -71,7 +73,7 @@ module Guard
|
|
71
73
|
# @param [Hash] options the output options
|
72
74
|
#
|
73
75
|
def suite_name(message, options = {})
|
74
|
-
::
|
76
|
+
Compat::UI.info(color(message, ';33'), options)
|
75
77
|
end
|
76
78
|
|
77
79
|
# Outputs a system notification.
|
@@ -82,7 +84,7 @@ module Guard
|
|
82
84
|
# @option options [String] :title the title of the system notification
|
83
85
|
#
|
84
86
|
def notify(message, options = {})
|
85
|
-
::
|
87
|
+
Compat::UI.notify(message, options)
|
86
88
|
end
|
87
89
|
|
88
90
|
private
|
@@ -93,7 +95,7 @@ module Guard
|
|
93
95
|
# @param [String] color_code the color code
|
94
96
|
#
|
95
97
|
def color(text, color_code)
|
96
|
-
::
|
98
|
+
Compat::UI.color_enabled? ? "\e[0#{ color_code }m#{ text }\e[0m" : text
|
97
99
|
end
|
98
100
|
end
|
99
101
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'guard/compat/plugin'
|
2
|
+
|
1
3
|
module Guard
|
2
|
-
class Jasmine
|
4
|
+
class Jasmine < Plugin
|
3
5
|
# The inspector verifies if the changed paths are valid
|
4
6
|
# for Guard::Jasmine. Please note that request to {.clean}
|
5
7
|
# paths keeps the current valid files cached until {.clear} is
|
@@ -2,7 +2,7 @@
|
|
2
2
|
var exitSuccessfully, jasmineAvailable, options, page, phantomExit, reportError, reporterMissing, reporterReady, specsDone, specsTimedout, waitFor;
|
3
3
|
|
4
4
|
options = {
|
5
|
-
url: phantom.args[0] || 'http://
|
5
|
+
url: phantom.args[0] || 'http://localhost:3000/jasmine',
|
6
6
|
timeout: parseInt(phantom.args[1] || 10000)
|
7
7
|
};
|
8
8
|
|
@@ -12,6 +12,11 @@
|
|
12
12
|
return reportError("Javascript error encountered on Jasmine test page: " + message, trace);
|
13
13
|
};
|
14
14
|
|
15
|
+
page.onResourceError = function(error) {
|
16
|
+
page.reason = error.errorString;
|
17
|
+
return page.reason_url = error.url;
|
18
|
+
};
|
19
|
+
|
15
20
|
page.onInitialized = function() {
|
16
21
|
page.injectJs('guard-reporter.js');
|
17
22
|
return page.evaluate(function() {
|
@@ -26,7 +31,7 @@
|
|
26
31
|
|
27
32
|
page.onLoadFinished = function(status) {
|
28
33
|
if (status !== 'success') {
|
29
|
-
return reportError("Unable to access Jasmine specs at " +
|
34
|
+
return reportError("Unable to access Jasmine specs at " + page.reason_url + ". " + page.reason);
|
30
35
|
} else {
|
31
36
|
return waitFor(reporterReady, jasmineAvailable, options.timeout, reporterMissing);
|
32
37
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# Set default values
|
3
3
|
options =
|
4
|
-
url: phantom.args[0] || 'http://
|
4
|
+
url: phantom.args[0] || 'http://localhost:3000/jasmine'
|
5
5
|
timeout: parseInt(phantom.args[1] || 10000)
|
6
6
|
|
7
7
|
# Create the web page.
|
@@ -12,6 +12,10 @@ page = require('webpage').create()
|
|
12
12
|
page.onError = (message, trace) ->
|
13
13
|
reportError "Javascript error encountered on Jasmine test page: #{ message }", trace
|
14
14
|
|
15
|
+
page.onResourceError = (error)->
|
16
|
+
page.reason = error.errorString
|
17
|
+
page.reason_url = error.url
|
18
|
+
|
15
19
|
# Once the page is initialized, setup the script for
|
16
20
|
# the GuardReporter class
|
17
21
|
page.onInitialized = ->
|
@@ -24,7 +28,7 @@ page.onInitialized = ->
|
|
24
28
|
# Once the page is finished loading
|
25
29
|
page.onLoadFinished = (status)->
|
26
30
|
if status isnt 'success'
|
27
|
-
reportError "Unable to access Jasmine specs at #{
|
31
|
+
reportError "Unable to access Jasmine specs at #{page.reason_url}. #{page.reason}"
|
28
32
|
else
|
29
33
|
waitFor reporterReady, jasmineAvailable, options.timeout, reporterMissing
|
30
34
|
|
data/lib/guard/jasmine/runner.rb
CHANGED
@@ -2,10 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'multi_json'
|
4
4
|
require 'fileutils'
|
5
|
+
|
6
|
+
require 'guard/compat/plugin'
|
7
|
+
require 'guard/jasmine'
|
5
8
|
require 'guard/jasmine/util'
|
6
9
|
|
7
10
|
module Guard
|
8
|
-
class Jasmine
|
11
|
+
class Jasmine < Plugin
|
9
12
|
# The Jasmine runner handles the execution of the spec through the PhantomJS binary,
|
10
13
|
# evaluates the JSON response from the PhantomJS Script `guard_jasmine.coffee`,
|
11
14
|
# writes the result to the console and triggers optional system notifications.
|
data/lib/guard/jasmine/server.rb
CHANGED
@@ -5,8 +5,10 @@ require 'timeout'
|
|
5
5
|
require 'childprocess'
|
6
6
|
require 'jasmine'
|
7
7
|
|
8
|
+
require 'guard/compat/plugin'
|
9
|
+
|
8
10
|
module Guard
|
9
|
-
class Jasmine
|
11
|
+
class Jasmine < Plugin
|
10
12
|
# Start and stop a Jasmine test server for requesting the specs
|
11
13
|
# from PhantomJS.
|
12
14
|
#
|
@@ -47,7 +49,7 @@ module Guard
|
|
47
49
|
#
|
48
50
|
def stop
|
49
51
|
if process
|
50
|
-
::
|
52
|
+
Compat::UI.info 'Guard::Jasmine stops server.'
|
51
53
|
process.stop(5)
|
52
54
|
end
|
53
55
|
end
|
@@ -105,7 +107,7 @@ module Guard
|
|
105
107
|
rackup_config = options[:rackup_config]
|
106
108
|
coverage = options[:coverage] ? 'on' : 'off'
|
107
109
|
|
108
|
-
::
|
110
|
+
Compat::UI.info "Guard::Jasmine starts #{ server } spec server on port #{ port } in #{ environment } environment (coverage #{ coverage })."
|
109
111
|
execute(options, ['rackup', '-E', environment.to_s, '-p', port.to_s, '-s', server.to_s, rackup_config])
|
110
112
|
end
|
111
113
|
|
@@ -121,7 +123,7 @@ module Guard
|
|
121
123
|
environment = options[:server_env]
|
122
124
|
coverage = options[:coverage] ? 'on' : 'off'
|
123
125
|
|
124
|
-
::
|
126
|
+
Compat::UI.info "Guard::Jasmine starts Unicorn spec server on port #{ port } in #{ environment } environment (coverage #{ coverage })."
|
125
127
|
execute(options, ['unicorn_rails', '-E', environment.to_s, '-p', port.to_s])
|
126
128
|
end
|
127
129
|
|
@@ -132,7 +134,7 @@ module Guard
|
|
132
134
|
# @option options [Symbol] server the rack server to use
|
133
135
|
#
|
134
136
|
def start_rake_server(port, task, options)
|
135
|
-
::
|
137
|
+
Compat::UI.info "Guard::Jasmine starts Jasmine Gem test server on port #{ port }."
|
136
138
|
execute(options, ['rake', task, "JASMINE_PORT=#{ port }"])
|
137
139
|
end
|
138
140
|
|
@@ -151,8 +153,8 @@ module Guard
|
|
151
153
|
process.io.inherit! if options[:verbose]
|
152
154
|
process.start
|
153
155
|
rescue => e
|
154
|
-
::
|
155
|
-
::
|
156
|
+
Compat::UI.error "Cannot start server using command #{ cmd.join(' ') }."
|
157
|
+
Compat::UI.error "Error was: #{ e.message }"
|
156
158
|
end
|
157
159
|
|
158
160
|
# Wait until the Jasmine test server is running.
|
@@ -164,7 +166,7 @@ module Guard
|
|
164
166
|
Timeout.timeout(timeout) do
|
165
167
|
loop do
|
166
168
|
begin
|
167
|
-
::TCPSocket.new('
|
169
|
+
::TCPSocket.new('localhost', port).close
|
168
170
|
break
|
169
171
|
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
170
172
|
# Ignore, server still not available
|
@@ -174,12 +176,12 @@ module Guard
|
|
174
176
|
end
|
175
177
|
|
176
178
|
rescue Timeout::Error
|
177
|
-
::
|
178
|
-
::
|
179
|
-
::
|
180
|
-
::
|
181
|
-
::
|
182
|
-
::
|
179
|
+
Compat::UI.warning "Timeout while waiting for the server to startup"
|
180
|
+
Compat::UI.warning "Most likely there is a configuration error that's preventing the server from starting"
|
181
|
+
Compat::UI.warning "You may need to increase the `:server_timeout` option."
|
182
|
+
Compat::UI.warning "The commandline that was used to start the server was:"
|
183
|
+
Compat::UI.warning cmd.join(' ')
|
184
|
+
Compat::UI.warning "You should attempt to run that and see if any errors occur"
|
183
185
|
|
184
186
|
throw :task_has_failed
|
185
187
|
end
|
data/lib/guard/jasmine/util.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kessler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '1.2'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '1.2'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: jasmine
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,48 +123,6 @@ dependencies:
|
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rake
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: rack
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
|
-
- !ruby/object:Gem::Dependency
|
155
|
-
name: yard
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '0'
|
161
|
-
type: :development
|
162
|
-
prerelease: false
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
126
|
description: Guard::Jasmine automatically tests your Jasmine specs on PhantomJS
|
169
127
|
email:
|
170
128
|
- michi@flinkfinger.com
|