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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12caddb0c39fa9e9eb322b6c951c89852701f973
4
- data.tar.gz: f0cf28ed90b43983707498f0687bda3c13eae5b1
3
+ metadata.gz: 45fc874553284f4ee8092b587b54ceb0ce8b48b2
4
+ data.tar.gz: 884c06766e3d4b531647e789dff96662cfd8dfcc
5
5
  SHA512:
6
- metadata.gz: 6e289b661a2d079a9da870b108afea5c1c3edb1da7e075ec09acfa000bd2ee25a5ef0b59f89a86b4e8e465d6da2765c38c2f16fb635f5798e548ea158c800696
7
- data.tar.gz: 2399a04e13a740d2e1eaf8a4cf0452d16f6ccf37074a099449cca08c75a48a8d4c73eb7967250f26017d451b9e0c2e1857b9dffe6197a01f6535b3b9bd751cb5
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: phantom.args[0] || 'http://localhost:3000/jasmine',
6
- timeout: parseInt(phantom.args[1] || 10000)
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 _ref;
56
- return (_ref = document.getElementsByTagName('body')[0]) != null ? _ref.innerText : void 0;
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 _ref;
88
- return (_ref = document.getElementsByTagName('body')[0]) != null ? _ref.innerText : void 0;
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
- return condition = test();
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 level, _i, _len, _ref;
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
- _ref = ConsoleCapture.levels;
37
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
38
- level = _ref[_i];
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 _j, _len1, _ref1;
43
+ var j, len1, ref1;
44
44
  this.original = {};
45
45
  this.captured = [];
46
- _ref1 = ConsoleCapture.levels;
47
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
48
- level = _ref1[_j];
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 _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]);
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 _results;
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, match, success, _i, _j, _len, _len1, _ref, _ref1;
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
- _ref = spec.failedExpectations || [];
123
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
124
- failure = _ref[_i];
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
- _ref1 = spec.passedExpectations || [];
140
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
141
- success = _ref1[_j];
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 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];
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
- _results.push(expected[key] = expected[key].name || "function");
156
+ results.push(expected[key] = expected[key].name || "function");
157
157
  } else if (isObject(expected[key])) {
158
- _results.push(expected[key] = expected[key].toString());
158
+ results.push(expected[key] = expected[key].toString());
159
159
  } else {
160
- _results.push(void 0);
160
+ results.push(void 0);
161
161
  }
162
162
  }
163
- return _results;
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 suites, _i, _len, _ref;
172
+ var i, len, ref, suites;
173
173
  suites = [].concat(suite.suites);
174
- _ref = suite.suites;
175
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
176
- suite = _ref[_i];
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 spec, stats, suite, _i, _j, _len, _len1, _ref, _ref1;
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
- _ref = this.eachSuite(this.stack[0]);
192
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
193
- suite = _ref[_i];
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
- _ref1 = suite.specs;
196
- for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
197
- spec = _ref1[_j];
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: phantom.args[0] || 'http://localhost:3000/jasmine'
5
- timeout: parseInt(phantom.args[1] || 10000)
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
- condition = test()
105
+ try
106
+ condition = test()
107
+ catch e
108
+ exitError(e)
101
109
  else
102
110
  clearInterval interval
103
111
  if condition
@@ -242,7 +242,7 @@ module Guard
242
242
  pp result if options[:debug]
243
243
  if result['error']
244
244
  if options[:is_cli]
245
- fail 'An error occurred in the Jasmine runner'
245
+ fail "Runner error: #{result['error']}"
246
246
  else
247
247
  notify_runtime_error(result)
248
248
  end
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  module JasmineVersion
3
3
  # Guard::Jasmine version that is used for the Gem specification
4
- VERSION = '2.0.2'
4
+ VERSION = '2.0.3'
5
5
  end
6
6
  end
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.2
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-01-01 00:00:00.000000000 Z
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.1'
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.1'
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.10'
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.10'
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.3
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