guard-jasmine 2.0.0beta1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/guard/jasmine/phantomjs/guard-reporter.js +36 -3
- data/lib/guard/jasmine/phantomjs/src/guard-reporter.coffee +20 -2
- data/lib/guard/jasmine/phantomjs/test/guard-reporter_spec.coffee +0 -2
- data/lib/guard/jasmine/runner.rb +2 -1
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01546cd2d6366e46000c481b06b3adeaaaa2f1c7
|
4
|
+
data.tar.gz: ba99f0a41f8880d28e1e0647a92e341fddd68ac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cb190cf4bf114ec1e05fce5884e16e7f92aac49d7ba54365c835092668cd1c9747176df8e45ec5822381d162974d3a6a16c9a70d7864834a6afb957366cae95
|
7
|
+
data.tar.gz: a03f6e169a0c472094ad6856d824e06e3e93227cecb75a3a3ee62adccf51f6dacd0598d3cdc93ee034b1737eeb432282fd2e1feb6750f3dcbff1d46ee5f826af
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(function() {
|
2
|
-
var ConsoleCapture, GuardReporter, extendObject;
|
2
|
+
var ConsoleCapture, GuardReporter, extendObject, isFunction, isObject;
|
3
3
|
|
4
4
|
extendObject = function(a, b) {
|
5
5
|
var key, value;
|
@@ -12,6 +12,16 @@
|
|
12
12
|
return a;
|
13
13
|
};
|
14
14
|
|
15
|
+
isObject = function(obj) {
|
16
|
+
var type;
|
17
|
+
type = typeof obj;
|
18
|
+
return type === 'function' || type === 'object' && !!obj;
|
19
|
+
};
|
20
|
+
|
21
|
+
isFunction = function(obj) {
|
22
|
+
return typeof obj === 'function' || false;
|
23
|
+
};
|
24
|
+
|
15
25
|
ConsoleCapture = (function() {
|
16
26
|
var level, _i, _len, _ref;
|
17
27
|
|
@@ -103,13 +113,13 @@
|
|
103
113
|
};
|
104
114
|
|
105
115
|
GuardReporter.prototype.specDone = function(spec) {
|
106
|
-
var error, failure, match, _i, _len, _ref;
|
116
|
+
var error, failure, match, success, _i, _j, _len, _len1, _ref, _ref1;
|
107
117
|
this.resultReceived = true;
|
108
118
|
spec = extendObject({
|
109
119
|
logs: this.console.captured,
|
110
120
|
errors: []
|
111
121
|
}, spec);
|
112
|
-
_ref = spec.failedExpectations;
|
122
|
+
_ref = spec.failedExpectations || [];
|
113
123
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114
124
|
failure = _ref[_i];
|
115
125
|
error = extendObject({
|
@@ -122,14 +132,37 @@
|
|
122
132
|
});
|
123
133
|
}
|
124
134
|
delete error.stack;
|
135
|
+
this.stringifyExpection(error);
|
125
136
|
spec.errors.push(error);
|
126
137
|
}
|
127
138
|
delete spec.failedExpectations;
|
139
|
+
_ref1 = spec.passedExpectations || [];
|
140
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
141
|
+
success = _ref1[_j];
|
142
|
+
this.stringifyExpection(success);
|
143
|
+
}
|
128
144
|
this.currentSuite.specs.push(spec);
|
129
145
|
this.resetConsoleLog();
|
130
146
|
return spec;
|
131
147
|
};
|
132
148
|
|
149
|
+
GuardReporter.prototype.stringifyExpection = function(expected) {
|
150
|
+
var key, _i, _len, _ref, _results;
|
151
|
+
_ref = ['actual', 'expected'];
|
152
|
+
_results = [];
|
153
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
154
|
+
key = _ref[_i];
|
155
|
+
if (isFunction(expected[key])) {
|
156
|
+
_results.push(expected[key] = expected[key].name || "function");
|
157
|
+
} else if (isObject(expected[key])) {
|
158
|
+
_results.push(expected[key] = expected[key].toString());
|
159
|
+
} else {
|
160
|
+
_results.push(void 0);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
return _results;
|
164
|
+
};
|
165
|
+
|
133
166
|
GuardReporter.prototype.resetConsoleLog = function() {
|
134
167
|
this.console.revert();
|
135
168
|
return this.console = new ConsoleCapture;
|
@@ -8,6 +8,13 @@ extendObject = (a, b)->
|
|
8
8
|
a[key] = value if b.hasOwnProperty(key)
|
9
9
|
return a
|
10
10
|
|
11
|
+
isObject =(obj)->
|
12
|
+
type = typeof obj;
|
13
|
+
return type == 'function' || type == 'object' && !!obj;
|
14
|
+
|
15
|
+
isFunction = (obj)->
|
16
|
+
return typeof obj == 'function' || false;
|
17
|
+
|
11
18
|
|
12
19
|
class ConsoleCapture
|
13
20
|
# Instead of attempting to de-activate the console dot reporter in hacky ways,
|
@@ -63,18 +70,29 @@ class GuardReporter
|
|
63
70
|
specDone: (spec)->
|
64
71
|
@resultReceived = true
|
65
72
|
spec = extendObject({ logs: @console.captured, errors: [] }, spec )
|
66
|
-
for failure in spec.failedExpectations
|
73
|
+
for failure in spec.failedExpectations||[]
|
67
74
|
error = extendObject({trace:[]}, failure )
|
68
75
|
while match = GuardReporter.STACK_MATCHER.exec( failure.stack )
|
69
76
|
error.trace.push({ file: match[1], line: parseInt(match[2]) })
|
70
77
|
delete error.stack
|
78
|
+
this.stringifyExpection(error)
|
71
79
|
spec.errors.push( error )
|
72
80
|
delete spec.failedExpectations
|
81
|
+
this.stringifyExpection(success) for success in spec.passedExpectations||[]
|
73
82
|
@currentSuite.specs.push( spec )
|
74
|
-
|
75
83
|
this.resetConsoleLog()
|
76
84
|
spec
|
77
85
|
|
86
|
+
# if the expected object is very large, we don't want to
|
87
|
+
# include it in the JSON reply. For instance a DOM Element
|
88
|
+
# will actually end up including the entire page (including script source)
|
89
|
+
stringifyExpection: (expected)->
|
90
|
+
for key in ['actual','expected']
|
91
|
+
if isFunction(expected[key])
|
92
|
+
expected[key] = expected[key].name || "function"
|
93
|
+
else if isObject(expected[key])
|
94
|
+
expected[key] = expected[key].toString()
|
95
|
+
|
78
96
|
resetConsoleLog: ->
|
79
97
|
@console.revert()
|
80
98
|
@console = new ConsoleCapture
|
@@ -22,8 +22,6 @@ describe 'Reporter', ->
|
|
22
22
|
|
23
23
|
it "reports counts", ->
|
24
24
|
@reporter.suiteStarted({name:'Blank'})
|
25
|
-
console.log("A %s Logging", "Test")
|
26
|
-
console.warn("This is your last warning")
|
27
25
|
@reporter.specDone( { status: 'passed', failedExpectations: [] } )
|
28
26
|
@reporter.specDone( { status: 'failed', failedExpectations: [{
|
29
27
|
matcherName:"toEqual",
|
data/lib/guard/jasmine/runner.rb
CHANGED
@@ -100,6 +100,7 @@ module Guard
|
|
100
100
|
"'#{ options[:junit_save_path] }'"
|
101
101
|
]
|
102
102
|
cmd = "#{ phantomjs_command } \"#{ suite }\" #{ arguments.collect { |i| i.to_s }.join(' ')}"
|
103
|
+
puts cmd if options[:debug]
|
103
104
|
IO.popen(cmd, 'r:UTF-8')
|
104
105
|
end
|
105
106
|
|
@@ -145,7 +146,7 @@ module Guard
|
|
145
146
|
if file != options[:spec_dir]
|
146
147
|
params[:spec] = suite_from_line_number(file) || suite_from_first_describe(file)
|
147
148
|
end
|
148
|
-
params.empty? ? "" : "?"+URI.encode_www_form(params)
|
149
|
+
params.empty? ? "" : "?"+URI.encode_www_form(params).gsub('+','%20')
|
149
150
|
end
|
150
151
|
|
151
152
|
# When providing a line number by either the option or by
|
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.0
|
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: 2014-
|
12
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -85,16 +85,16 @@ dependencies:
|
|
85
85
|
name: tilt
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
90
|
+
version: '0'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: bundler
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,7 +239,7 @@ files:
|
|
239
239
|
- lib/guard/jasmine/templates/Guardfile
|
240
240
|
- lib/guard/jasmine/util.rb
|
241
241
|
- lib/guard/jasmine/version.rb
|
242
|
-
homepage: https://github.com/
|
242
|
+
homepage: https://github.com/guard/guard-jasmine
|
243
243
|
licenses:
|
244
244
|
- MIT
|
245
245
|
metadata: {}
|