js-test-driver-rails 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.gitmodules +6 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +8 -9
- data/Rakefile +3 -28
- data/js-test-driver-rails.gemspec +25 -0
- data/lib/js_test_driver/version.rb +3 -0
- metadata +17 -183
- data/VERSION +0 -1
- data/vendor/jasmine-jstd-adapter/MIT.LICENSE +0 -22
- data/vendor/jasmine-jstd-adapter/README.md +0 -25
- data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +0 -6
- data/vendor/jasmine-jstd-adapter/jsTestDriverIit.conf +0 -6
- data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +0 -2343
- data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
- data/vendor/jasmine-jstd-adapter/server.sh +0 -1
- data/vendor/jasmine-jstd-adapter/src-test/iit/iitSpec.js +0 -46
- data/vendor/jasmine-jstd-adapter/src-test/tests.js +0 -89
- data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +0 -186
- data/vendor/jasmine-jstd-adapter/test-iit.sh +0 -1
- data/vendor/jasmine-jstd-adapter/test-regular.sh +0 -2
- data/vendor/jasmine-jstd-adapter/test.sh +0 -2
- data/vendor/jasmine/Gemfile +0 -6
- data/vendor/jasmine/MIT.LICENSE +0 -20
- data/vendor/jasmine/README.markdown +0 -28
- data/vendor/jasmine/Rakefile +0 -182
- data/vendor/jasmine/cruise_config.rb +0 -21
- data/vendor/jasmine/example/SpecRunner.html +0 -27
- data/vendor/jasmine/example/spec/PlayerSpec.js +0 -58
- data/vendor/jasmine/example/spec/SpecHelper.js +0 -9
- data/vendor/jasmine/example/src/Player.js +0 -22
- data/vendor/jasmine/example/src/Song.js +0 -7
- data/vendor/jasmine/images/fail-16.png +0 -0
- data/vendor/jasmine/images/fail.png +0 -0
- data/vendor/jasmine/images/go-16.png +0 -0
- data/vendor/jasmine/images/go.png +0 -0
- data/vendor/jasmine/images/pending-16.png +0 -0
- data/vendor/jasmine/images/pending.png +0 -0
- data/vendor/jasmine/images/question-bk.png +0 -0
- data/vendor/jasmine/images/questionbk-16.png +0 -0
- data/vendor/jasmine/images/spinner.gif +0 -0
- data/vendor/jasmine/jsdoc-template/allclasses.tmpl +0 -17
- data/vendor/jasmine/jsdoc-template/allfiles.tmpl +0 -56
- data/vendor/jasmine/jsdoc-template/class.tmpl +0 -646
- data/vendor/jasmine/jsdoc-template/index.tmpl +0 -39
- data/vendor/jasmine/jsdoc-template/publish.js +0 -184
- data/vendor/jasmine/jsdoc-template/static/default.css +0 -162
- data/vendor/jasmine/jsdoc-template/static/header.html +0 -2
- data/vendor/jasmine/jsdoc-template/static/index.html +0 -19
- data/vendor/jasmine/jsdoc-template/symbol.tmpl +0 -35
- data/vendor/jasmine/lib/jasmine-html.js +0 -188
- data/vendor/jasmine/lib/jasmine.css +0 -166
- data/vendor/jasmine/lib/jasmine.js +0 -2421
- data/vendor/jasmine/lib/json2.js +0 -478
- data/vendor/jasmine/spec/runner.html +0 -80
- data/vendor/jasmine/spec/suites/BaseSpec.js +0 -27
- data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
- data/vendor/jasmine/spec/suites/EnvSpec.js +0 -158
- data/vendor/jasmine/spec/suites/ExceptionsSpec.js +0 -107
- data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
- data/vendor/jasmine/spec/suites/MatchersSpec.js +0 -795
- data/vendor/jasmine/spec/suites/MockClockSpec.js +0 -38
- data/vendor/jasmine/spec/suites/MultiReporterSpec.js +0 -45
- data/vendor/jasmine/spec/suites/NestedResultsSpec.js +0 -54
- data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
- data/vendor/jasmine/spec/suites/QueueSpec.js +0 -23
- data/vendor/jasmine/spec/suites/ReporterSpec.js +0 -56
- data/vendor/jasmine/spec/suites/RunnerSpec.js +0 -267
- data/vendor/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
- data/vendor/jasmine/spec/suites/SpecSpec.js +0 -124
- data/vendor/jasmine/spec/suites/SpySpec.js +0 -201
- data/vendor/jasmine/spec/suites/SuiteSpec.js +0 -120
- data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
- data/vendor/jasmine/spec/suites/UtilSpec.js +0 -40
- data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +0 -87
- data/vendor/jasmine/src/Block.js +0 -22
- data/vendor/jasmine/src/Env.js +0 -264
- data/vendor/jasmine/src/JsApiReporter.js +0 -102
- data/vendor/jasmine/src/Matchers.js +0 -354
- data/vendor/jasmine/src/MultiReporter.js +0 -35
- data/vendor/jasmine/src/NestedResults.js +0 -80
- data/vendor/jasmine/src/PrettyPrinter.js +0 -122
- data/vendor/jasmine/src/Queue.js +0 -99
- data/vendor/jasmine/src/Reporter.js +0 -31
- data/vendor/jasmine/src/Runner.js +0 -77
- data/vendor/jasmine/src/Spec.js +0 -242
- data/vendor/jasmine/src/Suite.js +0 -82
- data/vendor/jasmine/src/WaitsBlock.js +0 -13
- data/vendor/jasmine/src/WaitsForBlock.js +0 -52
- data/vendor/jasmine/src/base.js +0 -589
- data/vendor/jasmine/src/html/TrivialReporter.js +0 -188
- data/vendor/jasmine/src/html/jasmine.css +0 -166
- data/vendor/jasmine/src/mock-timeout.js +0 -183
- data/vendor/jasmine/src/util.js +0 -67
- data/vendor/jasmine/src/version.json +0 -5
@@ -1,40 +0,0 @@
|
|
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
|
-
});
|
@@ -1,87 +0,0 @@
|
|
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
|
-
});
|
data/vendor/jasmine/src/Block.js
DELETED
@@ -1,22 +0,0 @@
|
|
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
|
-
};
|
data/vendor/jasmine/src/Env.js
DELETED
@@ -1,264 +0,0 @@
|
|
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
|
-
};
|
@@ -1,102 +0,0 @@
|
|
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
|
-
|