guard-jasmine 2.0.2 → 2.0.3
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-jasmine.js +23 -8
- data/lib/guard/jasmine/phantomjs/guard-reporter.js +42 -42
- data/lib/guard/jasmine/phantomjs/src/guard-jasmine.coffee +12 -4
- data/lib/guard/jasmine/runner.rb +1 -1
- data/lib/guard/jasmine/server.rb +3 -0
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45fc874553284f4ee8092b587b54ceb0ce8b48b2
|
4
|
+
data.tar.gz: 884c06766e3d4b531647e789dff96662cfd8dfcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7403cc1f1b17cdb34a59cabcaa5da958678d4be0972a53364f3fc5fbdb72075041d3ea48c40dadd4a6bbf5f79ebfb98ebfdd683c27e3756c96adf2df6c25e0f5
|
7
|
+
data.tar.gz: a7bfe2ca8e538707fccdbf0f71198ef5cc7e110c78570ed88aea080ec3b8ac42f2da6cac1c360372c221bb9065da921e38a828f14c092b64d7fbc1e3ecad0a8c
|
@@ -1,9 +1,11 @@
|
|
1
1
|
(function() {
|
2
|
-
var exitSuccessfully, jasmineAvailable, options, page, phantomExit, reportError, reporterMissing, reporterReady, specsDone, specsTimedout, waitFor;
|
2
|
+
var exitError, exitSuccessfully, jasmineAvailable, options, page, phantomExit, reportError, reporterMissing, reporterReady, specsDone, specsTimedout, system, waitFor;
|
3
|
+
|
4
|
+
system = require('system');
|
3
5
|
|
4
6
|
options = {
|
5
|
-
url:
|
6
|
-
timeout: parseInt(
|
7
|
+
url: system.args[0] || 'http://localhost:3000/jasmine',
|
8
|
+
timeout: parseInt(system.args.args[1] || 10000)
|
7
9
|
};
|
8
10
|
|
9
11
|
page = require('webpage').create();
|
@@ -52,8 +54,8 @@
|
|
52
54
|
reporterMissing = function() {
|
53
55
|
var text;
|
54
56
|
text = page.evaluate(function() {
|
55
|
-
var
|
56
|
-
return (
|
57
|
+
var ref;
|
58
|
+
return (ref = document.getElementsByTagName('body')[0]) != null ? ref.innerText : void 0;
|
57
59
|
});
|
58
60
|
return reportError("The reporter is not available!\nPerhaps the url ( " + options.url + " ) is incorrect?\n\n" + text);
|
59
61
|
};
|
@@ -81,11 +83,18 @@
|
|
81
83
|
return phantomExit();
|
82
84
|
};
|
83
85
|
|
86
|
+
exitError = function(message) {
|
87
|
+
console.log(JSON.stringify({
|
88
|
+
error: message
|
89
|
+
}));
|
90
|
+
return phantomExit(1);
|
91
|
+
};
|
92
|
+
|
84
93
|
specsTimedout = function() {
|
85
94
|
var text;
|
86
95
|
text = page.evaluate(function() {
|
87
|
-
var
|
88
|
-
return (
|
96
|
+
var ref;
|
97
|
+
return (ref = document.getElementsByTagName('body')[0]) != null ? ref.innerText : void 0;
|
89
98
|
});
|
90
99
|
reportError("Timeout waiting for the Jasmine test results!\n\n" + text);
|
91
100
|
return phantomExit(1);
|
@@ -100,8 +109,14 @@
|
|
100
109
|
interval = void 0;
|
101
110
|
start = Date.now(0);
|
102
111
|
wait = function() {
|
112
|
+
var e;
|
103
113
|
if (!condition && (Date.now() - start < timeout)) {
|
104
|
-
|
114
|
+
try {
|
115
|
+
return condition = test();
|
116
|
+
} catch (_error) {
|
117
|
+
e = _error;
|
118
|
+
return exitError(e);
|
119
|
+
}
|
105
120
|
} else {
|
106
121
|
clearInterval(interval);
|
107
122
|
if (condition) {
|
@@ -23,7 +23,7 @@
|
|
23
23
|
};
|
24
24
|
|
25
25
|
ConsoleCapture = (function() {
|
26
|
-
var
|
26
|
+
var i, len, level, ref;
|
27
27
|
|
28
28
|
ConsoleCapture.DOT_REPORTER_MATCH = /\[\d+m[F.]..0m/;
|
29
29
|
|
@@ -33,32 +33,32 @@
|
|
33
33
|
|
34
34
|
ConsoleCapture.original_levels = {};
|
35
35
|
|
36
|
-
|
37
|
-
for (
|
38
|
-
level =
|
36
|
+
ref = ConsoleCapture.levels;
|
37
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
38
|
+
level = ref[i];
|
39
39
|
ConsoleCapture.original_levels[level] = console[level];
|
40
40
|
}
|
41
41
|
|
42
42
|
function ConsoleCapture() {
|
43
|
-
var
|
43
|
+
var j, len1, ref1;
|
44
44
|
this.original = {};
|
45
45
|
this.captured = [];
|
46
|
-
|
47
|
-
for (
|
48
|
-
level =
|
46
|
+
ref1 = ConsoleCapture.levels;
|
47
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
48
|
+
level = ref1[j];
|
49
49
|
this._reassign_level(level);
|
50
50
|
}
|
51
51
|
}
|
52
52
|
|
53
53
|
ConsoleCapture.prototype.revert = function() {
|
54
|
-
var
|
55
|
-
|
56
|
-
|
57
|
-
for (
|
58
|
-
level =
|
59
|
-
|
54
|
+
var j, len1, ref1, results;
|
55
|
+
ref1 = ConsoleCapture.levels;
|
56
|
+
results = [];
|
57
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
58
|
+
level = ref1[j];
|
59
|
+
results.push(ConsoleCapture.original[level] = ConsoleCapture.original_levels[level]);
|
60
60
|
}
|
61
|
-
return
|
61
|
+
return results;
|
62
62
|
};
|
63
63
|
|
64
64
|
ConsoleCapture.prototype._reassign_level = function(level) {
|
@@ -113,15 +113,15 @@
|
|
113
113
|
};
|
114
114
|
|
115
115
|
GuardReporter.prototype.specDone = function(spec) {
|
116
|
-
var error, failure,
|
116
|
+
var error, failure, i, j, len, len1, match, ref, ref1, success;
|
117
117
|
this.resultReceived = true;
|
118
118
|
spec = extendObject({
|
119
119
|
logs: this.console.captured,
|
120
120
|
errors: []
|
121
121
|
}, spec);
|
122
|
-
|
123
|
-
for (
|
124
|
-
failure =
|
122
|
+
ref = spec.failedExpectations || [];
|
123
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
124
|
+
failure = ref[i];
|
125
125
|
error = extendObject({
|
126
126
|
trace: []
|
127
127
|
}, failure);
|
@@ -136,9 +136,9 @@
|
|
136
136
|
spec.errors.push(error);
|
137
137
|
}
|
138
138
|
delete spec.failedExpectations;
|
139
|
-
|
140
|
-
for (
|
141
|
-
success =
|
139
|
+
ref1 = spec.passedExpectations || [];
|
140
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
141
|
+
success = ref1[j];
|
142
142
|
this.stringifyExpection(success);
|
143
143
|
}
|
144
144
|
this.currentSuite.specs.push(spec);
|
@@ -147,20 +147,20 @@
|
|
147
147
|
};
|
148
148
|
|
149
149
|
GuardReporter.prototype.stringifyExpection = function(expected) {
|
150
|
-
var
|
151
|
-
|
152
|
-
|
153
|
-
for (
|
154
|
-
key =
|
150
|
+
var i, key, len, ref, results;
|
151
|
+
ref = ['actual', 'expected'];
|
152
|
+
results = [];
|
153
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
154
|
+
key = ref[i];
|
155
155
|
if (isFunction(expected[key])) {
|
156
|
-
|
156
|
+
results.push(expected[key] = expected[key].name || "function");
|
157
157
|
} else if (isObject(expected[key])) {
|
158
|
-
|
158
|
+
results.push(expected[key] = expected[key].toString());
|
159
159
|
} else {
|
160
|
-
|
160
|
+
results.push(void 0);
|
161
161
|
}
|
162
162
|
}
|
163
|
-
return
|
163
|
+
return results;
|
164
164
|
};
|
165
165
|
|
166
166
|
GuardReporter.prototype.resetConsoleLog = function() {
|
@@ -169,18 +169,18 @@
|
|
169
169
|
};
|
170
170
|
|
171
171
|
GuardReporter.prototype.eachSuite = function(suite) {
|
172
|
-
var
|
172
|
+
var i, len, ref, suites;
|
173
173
|
suites = [].concat(suite.suites);
|
174
|
-
|
175
|
-
for (
|
176
|
-
suite =
|
174
|
+
ref = suite.suites;
|
175
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
176
|
+
suite = ref[i];
|
177
177
|
suites = suites.concat(this.eachSuite(suite));
|
178
178
|
}
|
179
179
|
return suites;
|
180
180
|
};
|
181
181
|
|
182
182
|
GuardReporter.prototype.results = function() {
|
183
|
-
var
|
183
|
+
var i, j, len, len1, ref, ref1, spec, stats, suite;
|
184
184
|
stats = {
|
185
185
|
time: (Date.now() - this.startedAt) / 1000,
|
186
186
|
specs: 0,
|
@@ -188,13 +188,13 @@
|
|
188
188
|
pending: 0,
|
189
189
|
disabled: 0
|
190
190
|
};
|
191
|
-
|
192
|
-
for (
|
193
|
-
suite =
|
191
|
+
ref = this.eachSuite(this.stack[0]);
|
192
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
193
|
+
suite = ref[i];
|
194
194
|
stats.specs += suite.specs.length;
|
195
|
-
|
196
|
-
for (
|
197
|
-
spec =
|
195
|
+
ref1 = suite.specs;
|
196
|
+
for (j = 0, len1 = ref1.length; j < len1; j++) {
|
197
|
+
spec = ref1[j];
|
198
198
|
if (void 0 !== stats[spec.status]) {
|
199
199
|
stats[spec.status] += 1;
|
200
200
|
}
|
@@ -1,8 +1,9 @@
|
|
1
|
+
system = require('system');
|
1
2
|
|
2
3
|
# Set default values
|
3
4
|
options =
|
4
|
-
url:
|
5
|
-
timeout: parseInt(
|
5
|
+
url: system.args[0] || 'http://localhost:3000/jasmine'
|
6
|
+
timeout: parseInt(system.args.args[1] || 10000)
|
6
7
|
|
7
8
|
# Create the web page.
|
8
9
|
page = require('webpage').create()
|
@@ -15,7 +16,7 @@ page.onError = (message, trace) ->
|
|
15
16
|
page.onResourceError = (error)->
|
16
17
|
page.reason = error.errorString
|
17
18
|
page.reason_url = error.url
|
18
|
-
|
19
|
+
|
19
20
|
# Once the page is initialized, setup the script for
|
20
21
|
# the GuardReporter class
|
21
22
|
page.onInitialized = ->
|
@@ -74,6 +75,10 @@ exitSuccessfully = ->
|
|
74
75
|
console.log JSON.stringify( results )
|
75
76
|
phantomExit()
|
76
77
|
|
78
|
+
exitError = (message)->
|
79
|
+
console.log JSON.stringify({error: message})
|
80
|
+
phantomExit(1)
|
81
|
+
|
77
82
|
|
78
83
|
# Error message for when specs time out
|
79
84
|
specsTimedout = ->
|
@@ -97,7 +102,10 @@ waitFor = (test, ready, timeout = 10000, timeoutFunction)->
|
|
97
102
|
start = Date.now(0)
|
98
103
|
wait = ->
|
99
104
|
if !condition && (Date.now() - start < timeout)
|
100
|
-
|
105
|
+
try
|
106
|
+
condition = test()
|
107
|
+
catch e
|
108
|
+
exitError(e)
|
101
109
|
else
|
102
110
|
clearInterval interval
|
103
111
|
if condition
|
data/lib/guard/jasmine/runner.rb
CHANGED
data/lib/guard/jasmine/server.rb
CHANGED
@@ -147,6 +147,9 @@ module Guard
|
|
147
147
|
cmd.unshift("ruby", "-S")
|
148
148
|
end
|
149
149
|
self.cmd = cmd
|
150
|
+
if options[:debug]
|
151
|
+
puts "Starting server using: #{cmd.join(' ')}"
|
152
|
+
end
|
150
153
|
self.process = ChildProcess.build(*cmd.compact)
|
151
154
|
process.environment['COVERAGE'] = options[:coverage].to_s
|
152
155
|
process.environment['IGNORE_INSTRUMENTATION'] = options[:ignore_instrumentation].to_s
|
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.3
|
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: 2015-
|
12
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -45,28 +45,28 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '2.
|
48
|
+
version: '2.2'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '2.
|
55
|
+
version: '2.2'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: multi_json
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
62
|
+
version: '1.1'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
69
|
+
version: '1.1'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: childprocess
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,16 +99,16 @@ dependencies:
|
|
99
99
|
name: tilt
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
104
|
+
version: '2.0'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
111
|
+
version: '2.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: bundler
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: 1.3.6
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project: guard-jasmine
|
178
|
-
rubygems_version: 2.4.
|
178
|
+
rubygems_version: 2.4.5
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Guard gem for headless testing with Jasmine
|