guard-jasmine 1.19.2 → 2.0.0beta1

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -234
  3. data/lib/generators/guard_jasmine/install_generator.rb +17 -0
  4. data/lib/generators/guard_jasmine/templates/Guardfile +9 -0
  5. data/lib/guard/jasmine.rb +18 -15
  6. data/lib/guard/jasmine/cli.rb +5 -5
  7. data/lib/guard/jasmine/formatter.rb +10 -0
  8. data/lib/guard/jasmine/inspector.rb +1 -2
  9. data/lib/guard/jasmine/phantomjs/guard-jasmine.js +54 -180
  10. data/lib/guard/jasmine/phantomjs/guard-reporter.js +187 -0
  11. data/lib/guard/jasmine/phantomjs/src/guard-jasmine.coffee +101 -0
  12. data/lib/guard/jasmine/phantomjs/src/guard-reporter.coffee +109 -0
  13. data/lib/guard/jasmine/phantomjs/test/guard-reporter_spec.coffee +41 -0
  14. data/lib/guard/jasmine/runner.rb +178 -268
  15. data/lib/guard/jasmine/server.rb +17 -3
  16. data/lib/guard/jasmine/util.rb +1 -7
  17. data/lib/guard/jasmine/version.rb +1 -1
  18. metadata +135 -26
  19. data/lib/guard/jasmine/phantomjs/guard-jasmine.coffee +0 -193
  20. data/lib/guard/jasmine/phantomjs/lib/console.js +0 -188
  21. data/lib/guard/jasmine/phantomjs/lib/junit_reporter.js +0 -224
  22. data/lib/guard/jasmine/phantomjs/lib/reporter.js +0 -144
  23. data/lib/guard/jasmine/phantomjs/lib/result.js +0 -155
  24. data/lib/guard/jasmine/phantomjs/src/console.coffee +0 -149
  25. data/lib/guard/jasmine/phantomjs/src/reporter.coffee +0 -139
  26. data/lib/guard/jasmine/phantomjs/src/result.coffee +0 -95
  27. data/lib/guard/jasmine/phantomjs/test/console_spec.coffee +0 -125
  28. data/lib/guard/jasmine/phantomjs/test/reporter_spec.coffee +0 -0
  29. data/lib/guard/jasmine/phantomjs/test/result_spec.coffee +0 -311
@@ -1,125 +0,0 @@
1
- sinon = require 'sinon'
2
- {expect} = require 'chai'
3
-
4
- Console = require '../src/console'
5
-
6
- describe 'Console', ->
7
- beforeEach ->
8
- @log = sinon.stub()
9
- @console = { log: @log }
10
-
11
- new Console(@console)
12
-
13
- describe '#log', ->
14
- describe 'with strings', ->
15
- it 'logs a single string', ->
16
- @console.log 'Hello logger'
17
- expect(@log.args[0][0]).to.equal 'Hello logger'
18
-
19
- it 'concatenates multipe strings', ->
20
- @console.log 'Hello logger', 'We welcome you', 'Here on Earth'
21
- expect(@log.args[0][0]).to.equal 'Hello logger We welcome you Here on Earth'
22
-
23
- it 'replaces a single %s', ->
24
- @console.log 'Hello %s!', 'logger'
25
- expect(@log.args[0][0]).to.equal 'Hello logger!'
26
-
27
- it 'replaces multiple %s', ->
28
- @console.log 'Hello %s, we welcome you to %s!', 'logger', 'Switzerland'
29
- expect(@log.args[0][0]).to.equal 'Hello logger, we welcome you to Switzerland!'
30
-
31
- it 'attaches %s surplus strings', ->
32
- @console.log 'Hello %s, we welcome you to Switzerland!', 'logger', 'Yay!'
33
- expect(@log.args[0][0]).to.equal 'Hello logger, we welcome you to Switzerland! Yay!'
34
-
35
- describe 'with numbers', ->
36
- it 'logs a single number', ->
37
- @console.log 1
38
- expect(@log.args[0][0]).to.equal '1'
39
-
40
- it 'concatenates multipe numbers', ->
41
- @console.log 1, 2, 3, 4
42
- expect(@log.args[0][0]).to.equal '1 2 3 4'
43
-
44
- it 'replaces a single %d', ->
45
- @console.log 'Hello %d!', 1
46
- expect(@log.args[0][0]).to.equal 'Hello 1!'
47
-
48
- it 'replaces a single %i', ->
49
- @console.log 'Hello %i!', 3
50
- expect(@log.args[0][0]).to.equal 'Hello 3!'
51
-
52
- it 'replaces multiple %d', ->
53
- @console.log 'I can count %d, %d and %d!', 1, 2, 3
54
- expect(@log.args[0][0]).to.equal 'I can count 1, 2 and 3!'
55
-
56
- it 'replaces multiple %i', ->
57
- @console.log 'I can count reverse %i, %i and %i!', 3, 2, 1
58
- expect(@log.args[0][0]).to.equal 'I can count reverse 3, 2 and 1!'
59
-
60
- it 'attaches %d surplus numbers', ->
61
- @console.log 'Hello %d!', 1, 2, 3
62
- expect(@log.args[0][0]).to.equal 'Hello 1! 2 3'
63
-
64
- it 'attaches %i surplus numbers', ->
65
- @console.log 'Hello %i!', 1, 2, 3
66
- expect(@log.args[0][0]).to.equal 'Hello 1! 2 3'
67
-
68
- describe 'with objects', ->
69
- it 'logs a boolean', ->
70
- @console.log true, false
71
- expect(@log.args[0][0]).to.equal 'true false'
72
-
73
- it 'logs a date', ->
74
- @console.log new Date('Thu Mar 08 2012 20:28:56 GMT+0100 (CET)')
75
- expect(@log.args[0][0]).to.equal 'Thu Mar 08 2012 20:28:56 GMT+0100 (CET)'
76
-
77
- it 'logs an array', ->
78
- @console.log [1, 2, 3, 4]
79
- expect(@log.args[0][0]).to.equal '[1, 2, 3, 4]'
80
-
81
- it 'logs an object', ->
82
- @console.log { a: 1 }
83
- expect(@log.args[0][0]).to.equal '{ a: 1 }'
84
-
85
- it 'logs a nested object', ->
86
- @console.log "Hello object %o. Nice to meet you", { a: 1, b: { x: 1 } }
87
- expect(@log.args[0][0]).to.equal 'Hello object { a: 1, b: { x: 1 } }. Nice to meet you'
88
-
89
- it 'logs a nested object until depth 2', ->
90
- @console.log "Hello object %o. Nice to meet you", { a: 1, b: { x: { a: 1, b: { x: 1 } } } }
91
- expect(@log.args[0][0]).to.equal 'Hello object { a: 1, b: { x: { a: 1, b: [Object] } } }. Nice to meet you'
92
-
93
- describe 'with an Object that implements toString()', ->
94
- it '%s logs the custom string representation', ->
95
- @console.log 'I have a toString(): %s!', { toString: -> '[Yepa]' }
96
- expect(@log.args[0][0]).to.equal 'I have a toString(): [Yepa]!'
97
-
98
- it '%o logs the custom string representation', ->
99
- @console.log 'I have a toString(): %o!', { toString: -> '[Yepa]' }
100
- expect(@log.args[0][0]).to.equal 'I have a toString(): [Yepa]!'
101
-
102
- describe 'with an Object that implements toJSON()', ->
103
- it '%o logs the custom JSON representation', ->
104
- @console.log 'I have a toJSON(): %o!', { toJSON: -> { a: 1 } }
105
- expect(@log.args[0][0]).to.equal 'I have a toJSON(): { a: 1 }!'
106
-
107
- describe '#info', ->
108
- it 'prefixes a string with INFO', ->
109
- @console.info true, { a: 1 }, 'Hello logger'
110
- expect(@log.args[0][0]).to.equal 'INFO: true { a: 1 } Hello logger'
111
-
112
- describe '#warn', ->
113
- it 'prefixes a string with WARN', ->
114
- @console.warn true, { a: 1 }, 'Hello logger'
115
- expect(@log.args[0][0]).to.equal 'WARN: true { a: 1 } Hello logger'
116
-
117
- describe '#error', ->
118
- it 'prefixes a string with ERROR', ->
119
- @console.error true, { a: 1 }, 'Hello logger'
120
- expect(@log.args[0][0]).to.equal 'ERROR: true { a: 1 } Hello logger'
121
-
122
- describe '#debug', ->
123
- it 'prefixes a string with DEBUG', ->
124
- @console.debug true, { a: 1 }, 'Hello logger'
125
- expect(@log.args[0][0]).to.equal 'DEBUG: true { a: 1 } Hello logger'
@@ -1,311 +0,0 @@
1
- sinon = require 'sinon'
2
- {expect} = require 'chai'
3
-
4
- Result = require '../src/result'
5
-
6
- describe 'Result', ->
7
- beforeEach ->
8
- @logObj =
9
- 0: ['Log 1', 'Another Log']
10
- 1: ['Log 2']
11
- 3: ['Log 4', 'more Logs']
12
-
13
- @errorsObj =
14
- 1: [{ msg: 'Failure 1', trace: { file: 'a file' }}]
15
- 2: [{ msg: 'Failure 2', trace: { file: 'another file' }}]
16
- 3: [{ msg: 'Failure 3', trace: { file: 'file' }}]
17
-
18
- @resultObj =
19
- passed: false
20
- stats:
21
- failures: 1
22
- specs: 4
23
- time: 0.10
24
- specs: [
25
- {
26
- description: "Spec 1"
27
- id: 0
28
- passed: true
29
- }
30
- ]
31
- suites: [
32
- {
33
- description: "Suite 1"
34
- id: 0
35
- passed: true
36
- specs: [
37
- {
38
- description: "Spec 2"
39
- id: 1
40
- passed: true
41
- }
42
- {
43
- description: "Spec 3"
44
- id: 2
45
- passed: true
46
- }
47
- ]
48
- suites: [
49
- description: "Suite 2"
50
- id: 1
51
- passed: false
52
- specs: [
53
- {
54
- description: "Spec 4"
55
- id: 3
56
- passed: false
57
- }
58
- ]
59
- suites: []
60
- ]
61
- }
62
- ]
63
-
64
- describe '#prepare', ->
65
- describe 'when console and errors are :never', ->
66
- beforeEach ->
67
- @result = new Result(@resultObj, @logObj, @errorsObj, { console: 'never', errors: 'never' }).process()
68
-
69
- it 'does not add the log and error statements to the specs', ->
70
- expected = {
71
- passed: false
72
- stats:
73
- failures: 1
74
- specs: 4
75
- time: 0.10
76
- specs: [
77
- {
78
- description: "Spec 1"
79
- passed: true
80
- }
81
- ]
82
- suites: [
83
- {
84
- description: "Suite 1"
85
- passed: true
86
- specs: [
87
- {
88
- description: "Spec 2"
89
- passed: true
90
- }
91
- {
92
- description: "Spec 3"
93
- passed: true
94
- }
95
- ]
96
- suites: [
97
- description: "Suite 2"
98
- passed: false
99
- specs: [
100
- {
101
- description: "Spec 4"
102
- passed: false
103
- }
104
- ]
105
- suites: []
106
- ]
107
- }
108
- ]
109
- }
110
-
111
- expect(@result).to.eql expected
112
-
113
- describe 'when console is :always', ->
114
- beforeEach ->
115
- @result = new Result(@resultObj, @logObj, @errorsObj, { console: 'always', errors: 'never' }).process()
116
-
117
- it 'does add all the log statements to the specs', ->
118
- expected = {
119
- passed: false
120
- stats:
121
- failures: 1
122
- specs: 4
123
- time: 0.10
124
- specs: [
125
- {
126
- description: "Spec 1"
127
- passed: true
128
- logs: ['Log 1', 'Another Log']
129
- }
130
- ]
131
- suites: [
132
- {
133
- description: "Suite 1"
134
- passed: true
135
- specs: [
136
- {
137
- description: "Spec 2"
138
- passed: true
139
- logs: ['Log 2']
140
- }
141
- {
142
- description: "Spec 3"
143
- passed: true
144
- }
145
- ]
146
- suites: [
147
- description: "Suite 2"
148
- passed: false
149
- specs: [
150
- {
151
- description: "Spec 4"
152
- passed: false
153
- logs: ['Log 4', 'more Logs']
154
- }
155
- ]
156
- suites: []
157
- ]
158
- }
159
- ]
160
- }
161
-
162
- expect(@result).to.eql expected
163
-
164
- describe 'when console is :failure', ->
165
- beforeEach ->
166
- @result = new Result(@resultObj, @logObj, @errorsObj, { console: 'failure', errors: 'never' }).process()
167
-
168
- it 'does add the log statements to the failing specs', ->
169
- expected = {
170
- passed: false
171
- stats:
172
- failures: 1
173
- specs: 4
174
- time: 0.10
175
- specs: [
176
- {
177
- description: "Spec 1"
178
- passed: true
179
- }
180
- ]
181
- suites: [
182
- {
183
- description: "Suite 1"
184
- passed: true
185
- specs: [
186
- {
187
- description: "Spec 2"
188
- passed: true
189
- }
190
- {
191
- description: "Spec 3"
192
- passed: true
193
- }
194
- ]
195
- suites: [
196
- description: "Suite 2"
197
- passed: false
198
- specs: [
199
- {
200
- description: "Spec 4"
201
- passed: false
202
- logs: ['Log 4', 'more Logs']
203
- }
204
- ]
205
- suites: []
206
- ]
207
- }
208
- ]
209
- }
210
-
211
- expect(@result).to.eql expected
212
-
213
- describe 'when errors is :always', ->
214
- beforeEach ->
215
- @result = new Result(@resultObj, @logObj, @errorsObj, { console: 'never', errors: 'always' }).process()
216
-
217
- it 'does add all the log statements to the specs', ->
218
- expected = {
219
- passed: false
220
- stats:
221
- failures: 1
222
- specs: 4
223
- time: 0.10
224
- specs: [
225
- {
226
- description: "Spec 1"
227
- passed: true
228
- }
229
- ]
230
- suites: [
231
- {
232
- description: "Suite 1"
233
- passed: true
234
- specs: [
235
- {
236
- description: "Spec 2"
237
- passed: true
238
- errors: [{ msg: 'Failure 1', trace: { file: 'a file' }}]
239
- }
240
- {
241
- description: "Spec 3"
242
- passed: true
243
- errors: [{ msg: 'Failure 2', trace: { file: 'another file' }}]
244
- }
245
- ]
246
- suites: [
247
- description: "Suite 2"
248
- passed: false
249
- specs: [
250
- {
251
- description: "Spec 4"
252
- passed: false
253
- errors: [{ msg: 'Failure 3', trace: { file: 'file' }}]
254
- }
255
- ]
256
- suites: []
257
- ]
258
- }
259
- ]
260
- }
261
-
262
- expect(@result).to.eql expected
263
-
264
- describe 'when errors is :failure', ->
265
- beforeEach ->
266
- @result = new Result(@resultObj, @logObj, @errorsObj, { console: 'never', errors: 'failure' }).process()
267
-
268
- it 'does add the log statements to the failing specs', ->
269
- expected = {
270
- passed: false
271
- stats:
272
- failures: 1
273
- specs: 4
274
- time: 0.10
275
- specs: [
276
- {
277
- description: "Spec 1"
278
- passed: true
279
- }
280
- ]
281
- suites: [
282
- {
283
- description: "Suite 1"
284
- passed: true
285
- specs: [
286
- {
287
- description: "Spec 2"
288
- passed: true
289
- }
290
- {
291
- description: "Spec 3"
292
- passed: true
293
- }
294
- ]
295
- suites: [
296
- description: "Suite 2"
297
- passed: false
298
- specs: [
299
- {
300
- description: "Spec 4"
301
- passed: false
302
- errors: [{ msg: 'Failure 3', trace: { file: 'file' }}]
303
- }
304
- ]
305
- suites: []
306
- ]
307
- }
308
- ]
309
- }
310
-
311
- expect(@result).to.eql expected