guard-jasmine 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -5
- data/lib/guard/jasmine/phantomjs/lib/console.js +19 -7
- data/lib/guard/jasmine/phantomjs/lib/reporter.js +10 -8
- data/lib/guard/jasmine/phantomjs/lib/result.js +12 -4
- data/lib/guard/jasmine/phantomjs/src/reporter.coffee +4 -5
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +3 -131
data/README.md
CHANGED
@@ -158,7 +158,7 @@ guard :jasmine, :jasmine_url => 'http://127.0.0.1:8888/jasmine-stories' do
|
|
158
158
|
end
|
159
159
|
```
|
160
160
|
|
161
|
-
## Rails without the asset pipeline
|
161
|
+
## Rails without the asset pipeline
|
162
162
|
|
163
163
|
With Rails without the asset pipeline or a plain Ruby project, you can use [the Jasmine Gem][] to configure your Jasmine
|
164
164
|
specs and server the Jasmine runner. You don't have full access to your running Rails app, but it's anyway a good
|
@@ -231,8 +231,9 @@ guard 'coffeescript', :input => 'spec/coffeescripts', :output => 'spec/javascrip
|
|
231
231
|
|
232
232
|
If you like to use Guard::Jasmine with a plain Ruby project, you can create a Rack configuration file
|
233
233
|
that starts a Rails instance with the asset pipeline and Jasminerice, having the full Rails testing
|
234
|
-
comfort for non-Rails projects. Please have a look at the
|
235
|
-
|
234
|
+
comfort for non-Rails projects. Please have a look at the
|
235
|
+
[Rails with the asset pipeline](https://github.com/netzpirat/guard-jasmine#rails-with-the-asset-pipeline-setup)
|
236
|
+
section to see how the setup works.
|
236
237
|
|
237
238
|
First you have the add the needed Gems to your `Gemfile`:
|
238
239
|
|
@@ -247,7 +248,7 @@ group :development, :test do
|
|
247
248
|
gem 'tzinfo'
|
248
249
|
|
249
250
|
gem 'thin'
|
250
|
-
|
251
|
+
|
251
252
|
gem 'jasminerice'
|
252
253
|
gem 'jquery-rails'
|
253
254
|
gem 'guard-jasmine'
|
@@ -600,7 +601,7 @@ before_script:
|
|
600
601
|
|
601
602
|
When building an engine, your code lives at the root but the dummy Rails app is in another folder (like `test/dummy` or `spec/dummy`).
|
602
603
|
|
603
|
-
So you have to import the Jasmine task in your `Rakefile`:
|
604
|
+
So you have to import the Jasmine task in your `Rakefile`:
|
604
605
|
|
605
606
|
```bash
|
606
607
|
$ echo "import 'lib/tasks/jasmine.rake'" > Rakefile
|
@@ -1,6 +1,6 @@
|
|
1
1
|
(function() {
|
2
2
|
var Console,
|
3
|
-
__slice =
|
3
|
+
__slice = [].slice;
|
4
4
|
|
5
5
|
Console = (function() {
|
6
6
|
|
@@ -59,7 +59,9 @@
|
|
59
59
|
switch (type) {
|
60
60
|
case '%s':
|
61
61
|
result = String(object);
|
62
|
-
if (match = /'(.*)'/.exec(result))
|
62
|
+
if (match = /'(.*)'/.exec(result)) {
|
63
|
+
result = match[1];
|
64
|
+
}
|
63
65
|
break;
|
64
66
|
case '%d':
|
65
67
|
case '%i':
|
@@ -74,10 +76,14 @@
|
|
74
76
|
result = Console.pp(object.toJSON());
|
75
77
|
} else if (type === 'Object' && object.toString && object.toString() !== '[object Object]') {
|
76
78
|
result = Console.pp(object.toString());
|
77
|
-
if (match = /'(.*)'/.exec(result))
|
79
|
+
if (match = /'(.*)'/.exec(result)) {
|
80
|
+
result = match[1];
|
81
|
+
}
|
78
82
|
} else if (type === 'String') {
|
79
83
|
result = String(object);
|
80
|
-
if (match = /'(.*)'/.exec(result))
|
84
|
+
if (match = /'(.*)'/.exec(result)) {
|
85
|
+
result = match[1];
|
86
|
+
}
|
81
87
|
} else {
|
82
88
|
result = Console.pp(object);
|
83
89
|
}
|
@@ -87,7 +93,9 @@
|
|
87
93
|
|
88
94
|
Console.pp = function(object, depth) {
|
89
95
|
var key, result, type, value, _i, _len;
|
90
|
-
if (depth == null)
|
96
|
+
if (depth == null) {
|
97
|
+
depth = 0;
|
98
|
+
}
|
91
99
|
type = Object.prototype.toString.call(object).slice(8, -1);
|
92
100
|
result = '';
|
93
101
|
switch (type) {
|
@@ -160,9 +168,13 @@
|
|
160
168
|
})();
|
161
169
|
|
162
170
|
if (typeof module !== 'undefined' && module.exports) {
|
163
|
-
if (module)
|
171
|
+
if (module) {
|
172
|
+
module.exports = Console;
|
173
|
+
}
|
164
174
|
} else {
|
165
|
-
if (window)
|
175
|
+
if (window) {
|
176
|
+
new Console(window.console);
|
177
|
+
}
|
166
178
|
}
|
167
179
|
|
168
180
|
}).call(this);
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
ConsoleReporter.prototype.specCount = 0;
|
19
19
|
|
20
|
-
ConsoleReporter.prototype.currentSpecs =
|
20
|
+
ConsoleReporter.prototype.currentSpecs = {};
|
21
21
|
|
22
22
|
ConsoleReporter.prototype.nestedSuiteResults = {};
|
23
23
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
};
|
27
27
|
|
28
28
|
ConsoleReporter.prototype.reportSpecResults = function(spec) {
|
29
|
-
var messages, result, specResult, _i, _len, _ref;
|
29
|
+
var messages, result, specResult, _base, _i, _len, _name, _ref;
|
30
30
|
if (!spec.results().skipped) {
|
31
31
|
specResult = {
|
32
32
|
id: spec.id,
|
@@ -40,10 +40,13 @@
|
|
40
40
|
result = _ref[_i];
|
41
41
|
messages.push(result.message);
|
42
42
|
}
|
43
|
-
if (messages.length !== 0)
|
43
|
+
if (messages.length !== 0) {
|
44
|
+
specResult['messages'] = messages;
|
45
|
+
}
|
44
46
|
}
|
45
47
|
this.specCount += 1;
|
46
|
-
|
48
|
+
(_base = this.currentSpecs)[_name = spec.suite.id] || (_base[_name] = []);
|
49
|
+
return this.currentSpecs[spec.suite.id].push(specResult);
|
47
50
|
}
|
48
51
|
};
|
49
52
|
|
@@ -55,7 +58,7 @@
|
|
55
58
|
parent: (_ref = suite.parentSuite) != null ? _ref.id : void 0,
|
56
59
|
description: suite.description,
|
57
60
|
passed: suite.results().failedCount === 0,
|
58
|
-
specs: this.currentSpecs,
|
61
|
+
specs: this.currentSpecs[suite.id],
|
59
62
|
suites: []
|
60
63
|
};
|
61
64
|
if (suite.parentSuite != null) {
|
@@ -63,16 +66,15 @@
|
|
63
66
|
if (!this.nestedSuiteResults[parent]) {
|
64
67
|
this.nestedSuiteResults[parent] = [];
|
65
68
|
}
|
66
|
-
this.nestedSuiteResults[parent].push(suiteResult);
|
69
|
+
return this.nestedSuiteResults[parent].push(suiteResult);
|
67
70
|
} else {
|
68
71
|
this.addNestedSuites(suiteResult);
|
69
72
|
this.removeEmptySuites(suiteResult);
|
70
73
|
if (suiteResult.specs.length !== 0 || suiteResult.suites.length !== 0) {
|
71
|
-
this.runnerResult.suites.push(suiteResult);
|
74
|
+
return this.runnerResult.suites.push(suiteResult);
|
72
75
|
}
|
73
76
|
}
|
74
77
|
}
|
75
|
-
return this.currentSpecs = [];
|
76
78
|
};
|
77
79
|
|
78
80
|
ConsoleReporter.prototype.reportRunnerResults = function(runner) {
|
@@ -101,8 +101,12 @@
|
|
101
101
|
};
|
102
102
|
|
103
103
|
Result.prototype.process = function() {
|
104
|
-
if (this.options.console !== 'never')
|
105
|
-
|
104
|
+
if (this.options.console !== 'never') {
|
105
|
+
this.addLogs(this.result);
|
106
|
+
}
|
107
|
+
if (this.options.errors !== 'never') {
|
108
|
+
this.addErrors(this.result);
|
109
|
+
}
|
106
110
|
this.cleanResult(this.result);
|
107
111
|
return this.result;
|
108
112
|
};
|
@@ -112,9 +116,13 @@
|
|
112
116
|
})();
|
113
117
|
|
114
118
|
if (typeof module !== 'undefined' && module.exports) {
|
115
|
-
if (module)
|
119
|
+
if (module) {
|
120
|
+
module.exports = Result;
|
121
|
+
}
|
116
122
|
} else {
|
117
|
-
if (window)
|
123
|
+
if (window) {
|
124
|
+
window.Result = Result;
|
125
|
+
}
|
118
126
|
}
|
119
127
|
|
120
128
|
}).call(this);
|
@@ -14,7 +14,7 @@ class ConsoleReporter
|
|
14
14
|
}
|
15
15
|
|
16
16
|
specCount: 0
|
17
|
-
currentSpecs:
|
17
|
+
currentSpecs: {}
|
18
18
|
nestedSuiteResults: {}
|
19
19
|
|
20
20
|
# Report the start of a spec.
|
@@ -42,7 +42,8 @@ class ConsoleReporter
|
|
42
42
|
specResult['messages'] = messages if messages.length isnt 0
|
43
43
|
|
44
44
|
@specCount += 1
|
45
|
-
@currentSpecs.
|
45
|
+
@currentSpecs[spec.suite.id] or= []
|
46
|
+
@currentSpecs[spec.suite.id].push specResult
|
46
47
|
|
47
48
|
# Report results from a suite.
|
48
49
|
#
|
@@ -55,7 +56,7 @@ class ConsoleReporter
|
|
55
56
|
parent: suite.parentSuite?.id
|
56
57
|
description: suite.description
|
57
58
|
passed: suite.results().failedCount is 0
|
58
|
-
specs: @currentSpecs
|
59
|
+
specs: @currentSpecs[suite.id]
|
59
60
|
suites: []
|
60
61
|
}
|
61
62
|
|
@@ -70,8 +71,6 @@ class ConsoleReporter
|
|
70
71
|
if suiteResult.specs.length isnt 0 || suiteResult.suites.length isnt 0
|
71
72
|
@runnerResult.suites.push suiteResult
|
72
73
|
|
73
|
-
@currentSpecs = []
|
74
|
-
|
75
74
|
# Report results from the runner.
|
76
75
|
#
|
77
76
|
# @param runner [jasmine.Runner] the runner
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -91,134 +91,6 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: guard-rspec
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: guard-coffeescript
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: guard-shell
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: rspec
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: yard
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
- !ruby/object:Gem::Dependency
|
175
|
-
name: redcarpet
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
|
-
requirements:
|
179
|
-
- - ! '>='
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: pry
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
|
-
requirements:
|
195
|
-
- - ! '>='
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '0'
|
198
|
-
type: :development
|
199
|
-
prerelease: false
|
200
|
-
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
|
-
requirements:
|
203
|
-
- - ! '>='
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: '0'
|
206
|
-
- !ruby/object:Gem::Dependency
|
207
|
-
name: yajl-ruby
|
208
|
-
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
|
-
requirements:
|
211
|
-
- - ! '>='
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: '0'
|
214
|
-
type: :development
|
215
|
-
prerelease: false
|
216
|
-
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
|
-
requirements:
|
219
|
-
- - ! '>='
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: '0'
|
222
94
|
description: Guard::Jasmine automatically tests your Jasmine specs on PhantomJS
|
223
95
|
email:
|
224
96
|
- michi@netzpiraten.ch
|
@@ -266,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
138
|
version: '0'
|
267
139
|
segments:
|
268
140
|
- 0
|
269
|
-
hash:
|
141
|
+
hash: 2617870575409266914
|
270
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
143
|
none: false
|
272
144
|
requirements:
|