js-test-driver-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +2 -1
  2. data/README +40 -0
  3. data/Rakefile +1 -0
  4. data/VERSION +1 -1
  5. data/lib/js_test_driver.rb +5 -1
  6. data/lib/js_test_driver/config.rb +84 -7
  7. data/lib/js_test_driver/html_fixture.rb +40 -0
  8. data/lib/js_test_driver/runner.rb +21 -3
  9. data/test/fixtures/a.html +1 -0
  10. data/test/fixtures/b.html +1 -0
  11. data/test/fixtures/baz/a.html +1 -0
  12. data/test/fixtures/c.html +1 -0
  13. data/test/fixtures/foo/a.html +1 -0
  14. data/test/fixtures/foo/bar/a.html +1 -0
  15. data/test/fixtures/hello.txt +1 -0
  16. data/test/test_helper.rb +19 -0
  17. data/test/unit/config_test.rb +75 -2
  18. data/test/unit/html_fixture_test.rb +70 -0
  19. data/vendor/VERSIONS +3 -0
  20. data/vendor/jasmine-jstd-adapter/MIT.LICENSE +22 -0
  21. data/vendor/jasmine-jstd-adapter/README.md +25 -0
  22. data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +6 -0
  23. data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +2343 -0
  24. data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
  25. data/vendor/jasmine-jstd-adapter/server.sh +1 -0
  26. data/vendor/jasmine-jstd-adapter/src-test/tests.js +89 -0
  27. data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +111 -0
  28. data/vendor/jasmine-jstd-adapter/test.sh +1 -0
  29. data/vendor/jasmine/Gemfile +6 -0
  30. data/vendor/jasmine/MIT.LICENSE +20 -0
  31. data/vendor/jasmine/README.markdown +28 -0
  32. data/vendor/jasmine/Rakefile +178 -0
  33. data/vendor/jasmine/cruise_config.rb +21 -0
  34. data/vendor/jasmine/example/SpecRunner.html +27 -0
  35. data/vendor/jasmine/example/spec/PlayerSpec.js +58 -0
  36. data/vendor/jasmine/example/spec/SpecHelper.js +9 -0
  37. data/vendor/jasmine/example/src/Player.js +22 -0
  38. data/vendor/jasmine/example/src/Song.js +7 -0
  39. data/vendor/jasmine/images/fail-16.png +0 -0
  40. data/vendor/jasmine/images/fail.png +0 -0
  41. data/vendor/jasmine/images/go-16.png +0 -0
  42. data/vendor/jasmine/images/go.png +0 -0
  43. data/vendor/jasmine/images/pending-16.png +0 -0
  44. data/vendor/jasmine/images/pending.png +0 -0
  45. data/vendor/jasmine/images/question-bk.png +0 -0
  46. data/vendor/jasmine/images/questionbk-16.png +0 -0
  47. data/vendor/jasmine/images/spinner.gif +0 -0
  48. data/vendor/jasmine/lib/jasmine-html.js +182 -0
  49. data/vendor/jasmine/lib/jasmine.css +166 -0
  50. data/vendor/jasmine/lib/jasmine.js +2421 -0
  51. data/vendor/jasmine/lib/json2.js +478 -0
  52. data/vendor/jasmine/spec/runner.html +80 -0
  53. data/vendor/jasmine/spec/suites/BaseSpec.js +27 -0
  54. data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +97 -0
  55. data/vendor/jasmine/spec/suites/EnvSpec.js +158 -0
  56. data/vendor/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  57. data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +103 -0
  58. data/vendor/jasmine/spec/suites/MatchersSpec.js +795 -0
  59. data/vendor/jasmine/spec/suites/MockClockSpec.js +38 -0
  60. data/vendor/jasmine/spec/suites/MultiReporterSpec.js +45 -0
  61. data/vendor/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  62. data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  63. data/vendor/jasmine/spec/suites/QueueSpec.js +23 -0
  64. data/vendor/jasmine/spec/suites/ReporterSpec.js +56 -0
  65. data/vendor/jasmine/spec/suites/RunnerSpec.js +267 -0
  66. data/vendor/jasmine/spec/suites/SpecRunningSpec.js +1253 -0
  67. data/vendor/jasmine/spec/suites/SpecSpec.js +124 -0
  68. data/vendor/jasmine/spec/suites/SpySpec.js +201 -0
  69. data/vendor/jasmine/spec/suites/SuiteSpec.js +120 -0
  70. data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +235 -0
  71. data/vendor/jasmine/spec/suites/UtilSpec.js +40 -0
  72. data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +87 -0
  73. data/vendor/jasmine/src/Block.js +22 -0
  74. data/vendor/jasmine/src/Env.js +264 -0
  75. data/vendor/jasmine/src/JsApiReporter.js +102 -0
  76. data/vendor/jasmine/src/Matchers.js +354 -0
  77. data/vendor/jasmine/src/MultiReporter.js +35 -0
  78. data/vendor/jasmine/src/NestedResults.js +80 -0
  79. data/vendor/jasmine/src/PrettyPrinter.js +122 -0
  80. data/vendor/jasmine/src/Queue.js +99 -0
  81. data/vendor/jasmine/src/Reporter.js +31 -0
  82. data/vendor/jasmine/src/Runner.js +77 -0
  83. data/vendor/jasmine/src/Spec.js +242 -0
  84. data/vendor/jasmine/src/Suite.js +82 -0
  85. data/vendor/jasmine/src/WaitsBlock.js +13 -0
  86. data/vendor/jasmine/src/WaitsForBlock.js +52 -0
  87. data/vendor/jasmine/src/base.js +589 -0
  88. data/vendor/jasmine/src/html/TrivialReporter.js +182 -0
  89. data/vendor/jasmine/src/html/jasmine.css +166 -0
  90. data/vendor/jasmine/src/mock-timeout.js +183 -0
  91. data/vendor/jasmine/src/util.js +67 -0
  92. data/vendor/jasmine/src/version.json +5 -0
  93. metadata +102 -5
  94. data/test/unit/jsTestDriver.conf +0 -2
@@ -0,0 +1,40 @@
1
+ describe("jasmine.util", function() {
2
+ describe("extend", function () {
3
+ it("should add properies to a destination object ", function() {
4
+ var destination = {baz: 'baz'};
5
+ jasmine.util.extend(destination, {
6
+ foo: 'foo', bar: 'bar'
7
+ });
8
+ expect(destination).toEqual({foo: 'foo', bar: 'bar', baz: 'baz'});
9
+ });
10
+
11
+ it("should replace properies that already exist on a destination object", function() {
12
+ var destination = {foo: 'foo'};
13
+ jasmine.util.extend(destination, {
14
+ foo: 'bar'
15
+ });
16
+ expect(destination).toEqual({foo: 'bar'});
17
+ jasmine.util.extend(destination, {
18
+ foo: null
19
+ });
20
+ expect(destination).toEqual({foo: null});
21
+ });
22
+ });
23
+
24
+ describe("isArray_", function() {
25
+ it("should return true if the argument is an array", function() {
26
+ expect(jasmine.isArray_([])).toBe(true);
27
+ expect(jasmine.isArray_(['a'])).toBe(true);
28
+ expect(jasmine.isArray_(new Array())).toBe(true);
29
+ });
30
+
31
+ it("should return false if the argument is not an array", function() {
32
+ expect(jasmine.isArray_(undefined)).toBe(false);
33
+ expect(jasmine.isArray_({})).toBe(false);
34
+ expect(jasmine.isArray_(function() {})).toBe(false);
35
+ expect(jasmine.isArray_('foo')).toBe(false);
36
+ expect(jasmine.isArray_(5)).toBe(false);
37
+ expect(jasmine.isArray_(null)).toBe(false);
38
+ });
39
+ });
40
+ });
@@ -0,0 +1,87 @@
1
+ describe('WaitsForBlock', function () {
2
+ var env, suite, timeout, spec, message, onComplete, fakeTimer;
3
+ beforeEach(function() {
4
+ env = new jasmine.Env();
5
+ env.updateInterval = 0;
6
+ suite = new jasmine.Suite(env, 'suite 1');
7
+ timeout = 1000;
8
+ spec = new jasmine.Spec(env, suite);
9
+ message = "some error message";
10
+ onComplete = jasmine.createSpy("onComplete");
11
+ });
12
+
13
+ it('onComplete should be called if the latchFunction returns true', function () {
14
+ var latchFunction = function() {
15
+ return true;
16
+ };
17
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
18
+ expect(onComplete).not.toHaveBeenCalled();
19
+ block.execute(onComplete);
20
+ expect(onComplete).toHaveBeenCalled();
21
+ });
22
+
23
+ it('latchFunction should run in same scope as spec', function () {
24
+ var result;
25
+ var latchFunction = function() {
26
+ result = this.scopedValue;
27
+ };
28
+ spec.scopedValue = 'foo';
29
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
30
+ block.execute(onComplete);
31
+ expect(result).toEqual('foo');
32
+ });
33
+
34
+ it('should fail spec and call onComplete if there is an error in the latchFunction', function() {
35
+ var latchFunction = jasmine.createSpy('latchFunction').andThrow('some error');
36
+ spyOn(spec, 'fail');
37
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
38
+ block.execute(onComplete);
39
+ expect(spec.fail).toHaveBeenCalledWith('some error');
40
+ expect(onComplete).toHaveBeenCalled();
41
+ });
42
+
43
+ describe("if latchFunction returns false", function() {
44
+ var latchFunction, fakeTimer;
45
+ beforeEach(function() {
46
+ latchFunction = jasmine.createSpy('latchFunction').andReturn(false);
47
+ fakeTimer = new jasmine.FakeTimer();
48
+ env.setTimeout = fakeTimer.setTimeout;
49
+ env.clearTimeout = fakeTimer.clearTimeout;
50
+ env.setInterval = fakeTimer.setInterval;
51
+ env.clearInterval = fakeTimer.clearInterval;
52
+ });
53
+
54
+ it('latchFunction should be retried after 10 ms', function () {
55
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
56
+ expect(latchFunction).not.toHaveBeenCalled();
57
+ block.execute(onComplete);
58
+ expect(latchFunction.callCount).toEqual(1);
59
+ fakeTimer.tick(5);
60
+ expect(latchFunction.callCount).toEqual(1);
61
+ fakeTimer.tick(5);
62
+ expect(latchFunction.callCount).toEqual(2);
63
+ });
64
+
65
+ it('onComplete should be called if latchFunction returns true before timeout', function () {
66
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
67
+ expect(onComplete).not.toHaveBeenCalled();
68
+ block.execute(onComplete);
69
+ expect(onComplete).not.toHaveBeenCalled();
70
+ latchFunction.andReturn(true);
71
+ fakeTimer.tick(100);
72
+ expect(onComplete).toHaveBeenCalled();
73
+ });
74
+
75
+ it('spec should fail with the passed message if the timeout is reached (and not call onComplete)', function () {
76
+ spyOn(spec, 'fail');
77
+ var block = new jasmine.WaitsForBlock(env, timeout, latchFunction, message, spec);
78
+ block.execute(onComplete);
79
+ expect(spec.fail).not.toHaveBeenCalled();
80
+ fakeTimer.tick(timeout);
81
+ expect(spec.fail).toHaveBeenCalled();
82
+ var failMessage = spec.fail.mostRecentCall.args[0].message;
83
+ expect(failMessage).toMatch(message);
84
+ expect(onComplete).toHaveBeenCalled();
85
+ });
86
+ });
87
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Blocks are functions with executable code that make up a spec.
3
+ *
4
+ * @constructor
5
+ * @param {jasmine.Env} env
6
+ * @param {Function} func
7
+ * @param {jasmine.Spec} spec
8
+ */
9
+ jasmine.Block = function(env, func, spec) {
10
+ this.env = env;
11
+ this.func = func;
12
+ this.spec = spec;
13
+ };
14
+
15
+ jasmine.Block.prototype.execute = function(onComplete) {
16
+ try {
17
+ this.func.apply(this.spec);
18
+ } catch (e) {
19
+ this.spec.fail(e);
20
+ }
21
+ onComplete();
22
+ };
@@ -0,0 +1,264 @@
1
+ /**
2
+ * Environment for Jasmine
3
+ *
4
+ * @constructor
5
+ */
6
+ jasmine.Env = function() {
7
+ this.currentSpec = null;
8
+ this.currentSuite = null;
9
+ this.currentRunner_ = new jasmine.Runner(this);
10
+
11
+ this.reporter = new jasmine.MultiReporter();
12
+
13
+ this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
14
+ this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
15
+ this.lastUpdate = 0;
16
+ this.specFilter = function() {
17
+ return true;
18
+ };
19
+
20
+ this.nextSpecId_ = 0;
21
+ this.nextSuiteId_ = 0;
22
+ this.equalityTesters_ = [];
23
+
24
+ // wrap matchers
25
+ this.matchersClass = function() {
26
+ jasmine.Matchers.apply(this, arguments);
27
+ };
28
+ jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
29
+
30
+ jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
31
+ };
32
+
33
+
34
+ jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
35
+ jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
36
+ jasmine.Env.prototype.setInterval = jasmine.setInterval;
37
+ jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
38
+
39
+ /**
40
+ * @returns an object containing jasmine version build info, if set.
41
+ */
42
+ jasmine.Env.prototype.version = function () {
43
+ if (jasmine.version_) {
44
+ return jasmine.version_;
45
+ } else {
46
+ throw new Error('Version not set');
47
+ }
48
+ };
49
+
50
+ /**
51
+ * @returns string containing jasmine version build info, if set.
52
+ */
53
+ jasmine.Env.prototype.versionString = function() {
54
+ if (jasmine.version_) {
55
+ var version = this.version();
56
+ return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
57
+ } else {
58
+ return "version unknown";
59
+ }
60
+ };
61
+
62
+ /**
63
+ * @returns a sequential integer starting at 0
64
+ */
65
+ jasmine.Env.prototype.nextSpecId = function () {
66
+ return this.nextSpecId_++;
67
+ };
68
+
69
+ /**
70
+ * @returns a sequential integer starting at 0
71
+ */
72
+ jasmine.Env.prototype.nextSuiteId = function () {
73
+ return this.nextSuiteId_++;
74
+ };
75
+
76
+ /**
77
+ * Register a reporter to receive status updates from Jasmine.
78
+ * @param {jasmine.Reporter} reporter An object which will receive status updates.
79
+ */
80
+ jasmine.Env.prototype.addReporter = function(reporter) {
81
+ this.reporter.addReporter(reporter);
82
+ };
83
+
84
+ jasmine.Env.prototype.execute = function() {
85
+ this.currentRunner_.execute();
86
+ };
87
+
88
+ jasmine.Env.prototype.describe = function(description, specDefinitions) {
89
+ var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
90
+
91
+ var parentSuite = this.currentSuite;
92
+ if (parentSuite) {
93
+ parentSuite.add(suite);
94
+ } else {
95
+ this.currentRunner_.add(suite);
96
+ }
97
+
98
+ this.currentSuite = suite;
99
+
100
+ var declarationError = null;
101
+ try {
102
+ specDefinitions.call(suite);
103
+ } catch(e) {
104
+ declarationError = e;
105
+ }
106
+
107
+ this.currentSuite = parentSuite;
108
+
109
+ if (declarationError) {
110
+ this.it("encountered a declaration exception", function() {
111
+ throw declarationError;
112
+ });
113
+ }
114
+
115
+ return suite;
116
+ };
117
+
118
+ jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
119
+ if (this.currentSuite) {
120
+ this.currentSuite.beforeEach(beforeEachFunction);
121
+ } else {
122
+ this.currentRunner_.beforeEach(beforeEachFunction);
123
+ }
124
+ };
125
+
126
+ jasmine.Env.prototype.currentRunner = function () {
127
+ return this.currentRunner_;
128
+ };
129
+
130
+ jasmine.Env.prototype.afterEach = function(afterEachFunction) {
131
+ if (this.currentSuite) {
132
+ this.currentSuite.afterEach(afterEachFunction);
133
+ } else {
134
+ this.currentRunner_.afterEach(afterEachFunction);
135
+ }
136
+
137
+ };
138
+
139
+ jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
140
+ return {
141
+ execute: function() {
142
+ }
143
+ };
144
+ };
145
+
146
+ jasmine.Env.prototype.it = function(description, func) {
147
+ var spec = new jasmine.Spec(this, this.currentSuite, description);
148
+ this.currentSuite.add(spec);
149
+ this.currentSpec = spec;
150
+
151
+ if (func) {
152
+ spec.runs(func);
153
+ }
154
+
155
+ return spec;
156
+ };
157
+
158
+ jasmine.Env.prototype.xit = function(desc, func) {
159
+ return {
160
+ id: this.nextSpecId(),
161
+ runs: function() {
162
+ }
163
+ };
164
+ };
165
+
166
+ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
167
+ if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
168
+ return true;
169
+ }
170
+
171
+ a.__Jasmine_been_here_before__ = b;
172
+ b.__Jasmine_been_here_before__ = a;
173
+
174
+ var hasKey = function(obj, keyName) {
175
+ return obj != null && obj[keyName] !== jasmine.undefined;
176
+ };
177
+
178
+ for (var property in b) {
179
+ if (!hasKey(a, property) && hasKey(b, property)) {
180
+ mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
181
+ }
182
+ }
183
+ for (property in a) {
184
+ if (!hasKey(b, property) && hasKey(a, property)) {
185
+ mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
186
+ }
187
+ }
188
+ for (property in b) {
189
+ if (property == '__Jasmine_been_here_before__') continue;
190
+ if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
191
+ mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
192
+ }
193
+ }
194
+
195
+ if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
196
+ mismatchValues.push("arrays were not the same length");
197
+ }
198
+
199
+ delete a.__Jasmine_been_here_before__;
200
+ delete b.__Jasmine_been_here_before__;
201
+ return (mismatchKeys.length == 0 && mismatchValues.length == 0);
202
+ };
203
+
204
+ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
205
+ mismatchKeys = mismatchKeys || [];
206
+ mismatchValues = mismatchValues || [];
207
+
208
+ for (var i = 0; i < this.equalityTesters_.length; i++) {
209
+ var equalityTester = this.equalityTesters_[i];
210
+ var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
211
+ if (result !== jasmine.undefined) return result;
212
+ }
213
+
214
+ if (a === b) return true;
215
+
216
+ if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
217
+ return (a == jasmine.undefined && b == jasmine.undefined);
218
+ }
219
+
220
+ if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
221
+ return a === b;
222
+ }
223
+
224
+ if (a instanceof Date && b instanceof Date) {
225
+ return a.getTime() == b.getTime();
226
+ }
227
+
228
+ if (a instanceof jasmine.Matchers.Any) {
229
+ return a.matches(b);
230
+ }
231
+
232
+ if (b instanceof jasmine.Matchers.Any) {
233
+ return b.matches(a);
234
+ }
235
+
236
+ if (jasmine.isString_(a) && jasmine.isString_(b)) {
237
+ return (a == b);
238
+ }
239
+
240
+ if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
241
+ return (a == b);
242
+ }
243
+
244
+ if (typeof a === "object" && typeof b === "object") {
245
+ return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
246
+ }
247
+
248
+ //Straight check
249
+ return (a === b);
250
+ };
251
+
252
+ jasmine.Env.prototype.contains_ = function(haystack, needle) {
253
+ if (jasmine.isArray_(haystack)) {
254
+ for (var i = 0; i < haystack.length; i++) {
255
+ if (this.equals_(haystack[i], needle)) return true;
256
+ }
257
+ return false;
258
+ }
259
+ return haystack.indexOf(needle) >= 0;
260
+ };
261
+
262
+ jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
263
+ this.equalityTesters_.push(equalityTester);
264
+ };
@@ -0,0 +1,102 @@
1
+ /** JavaScript API reporter.
2
+ *
3
+ * @constructor
4
+ */
5
+ jasmine.JsApiReporter = function() {
6
+ this.started = false;
7
+ this.finished = false;
8
+ this.suites_ = [];
9
+ this.results_ = {};
10
+ };
11
+
12
+ jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
13
+ this.started = true;
14
+ var suites = runner.topLevelSuites();
15
+ for (var i = 0; i < suites.length; i++) {
16
+ var suite = suites[i];
17
+ this.suites_.push(this.summarize_(suite));
18
+ }
19
+ };
20
+
21
+ jasmine.JsApiReporter.prototype.suites = function() {
22
+ return this.suites_;
23
+ };
24
+
25
+ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
26
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
27
+ var summary = {
28
+ id: suiteOrSpec.id,
29
+ name: suiteOrSpec.description,
30
+ type: isSuite ? 'suite' : 'spec',
31
+ children: []
32
+ };
33
+
34
+ if (isSuite) {
35
+ var children = suiteOrSpec.children();
36
+ for (var i = 0; i < children.length; i++) {
37
+ summary.children.push(this.summarize_(children[i]));
38
+ }
39
+ }
40
+ return summary;
41
+ };
42
+
43
+ jasmine.JsApiReporter.prototype.results = function() {
44
+ return this.results_;
45
+ };
46
+
47
+ jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
48
+ return this.results_[specId];
49
+ };
50
+
51
+ //noinspection JSUnusedLocalSymbols
52
+ jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
53
+ this.finished = true;
54
+ };
55
+
56
+ //noinspection JSUnusedLocalSymbols
57
+ jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
58
+ };
59
+
60
+ //noinspection JSUnusedLocalSymbols
61
+ jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
62
+ this.results_[spec.id] = {
63
+ messages: spec.results().getItems(),
64
+ result: spec.results().failedCount > 0 ? "failed" : "passed"
65
+ };
66
+ };
67
+
68
+ //noinspection JSUnusedLocalSymbols
69
+ jasmine.JsApiReporter.prototype.log = function(str) {
70
+ };
71
+
72
+ jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
73
+ var results = {};
74
+ for (var i = 0; i < specIds.length; i++) {
75
+ var specId = specIds[i];
76
+ results[specId] = this.summarizeResult_(this.results_[specId]);
77
+ }
78
+ return results;
79
+ };
80
+
81
+ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
82
+ var summaryMessages = [];
83
+ var messagesLength = result.messages.length;
84
+ for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
85
+ var resultMessage = result.messages[messageIndex];
86
+ summaryMessages.push({
87
+ text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
88
+ passed: resultMessage.passed ? resultMessage.passed() : true,
89
+ type: resultMessage.type,
90
+ message: resultMessage.message,
91
+ trace: {
92
+ stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
93
+ }
94
+ });
95
+ }
96
+
97
+ return {
98
+ result : result.result,
99
+ messages : summaryMessages
100
+ };
101
+ };
102
+