evergreen 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/lib/evergreen/resources/evergreen.css +4 -0
- data/lib/evergreen/server.rb +1 -1
- data/lib/evergreen/version.rb +1 -1
- data/lib/jasmine/Gemfile +8 -0
- data/lib/jasmine/README.markdown +2 -1
- data/lib/jasmine/Rakefile +37 -1
- data/lib/jasmine/jasmine-core.gemspec +4 -1
- data/lib/jasmine/lib/jasmine-core/jasmine-html.js +77 -12
- data/lib/jasmine/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine/lib/jasmine-core/jasmine.js +107 -36
- data/lib/jasmine/lib/jasmine-core/version.rb +1 -1
- data/lib/jasmine/spec/core/ExceptionsSpec.js +113 -87
- data/lib/jasmine/spec/core/MatchersSpec.js +48 -2
- data/lib/jasmine/spec/core/PrettyPrintSpec.js +30 -0
- data/lib/jasmine/spec/core/RunnerSpec.js +13 -0
- data/lib/jasmine/spec/core/SpecRunningSpec.js +117 -84
- data/lib/jasmine/spec/core/SpySpec.js +15 -0
- data/lib/jasmine/spec/jasmine.yml +39 -0
- data/lib/jasmine/spec/jasmine_self_test_spec.rb +23 -0
- data/lib/jasmine/spec/tasks/build_github_pages_spec.rb +14 -23
- data/lib/jasmine/src/core/Block.js +9 -4
- data/lib/jasmine/src/core/Env.js +23 -0
- data/lib/jasmine/src/core/Matchers.js +19 -15
- data/lib/jasmine/src/core/PrettyPrinter.js +11 -4
- data/lib/jasmine/src/core/Queue.js +23 -4
- data/lib/jasmine/src/core/Spec.js +4 -4
- data/lib/jasmine/src/core/base.js +15 -2
- data/lib/jasmine/src/html/HtmlReporter.js +67 -3
- data/lib/jasmine/src/html/ReporterView.js +3 -3
- data/lib/jasmine/src/html/SpecView.js +5 -5
- data/lib/jasmine/src/html/SuiteView.js +1 -1
- data/lib/jasmine/src/html/_HTMLReporter.scss +49 -42
- data/lib/jasmine/src/html/jasmine.css +1 -0
- data/lib/jasmine/src/version.js +3 -3
- data/lib/jasmine/src/version.json +2 -2
- data/lib/jasmine/tasks/jasmine_dev/build_github_pages.rb +11 -14
- data/lib/jasmine/tasks/jasmine_dev/build_standalone_distribution.rb +3 -2
- data/lib/jasmine/tasks/jasmine_dev/build_standalone_runner.rb +3 -3
- data/spec/runner_spec.rb +0 -2
- data/spec/suite_spec.rb +7 -4
- metadata +4 -3
@@ -165,6 +165,21 @@ describe('Spies', function () {
|
|
165
165
|
expect(exception).toBeDefined();
|
166
166
|
});
|
167
167
|
|
168
|
+
|
169
|
+
it('to spy on an undefined method throws exception', function() {
|
170
|
+
var TestClass = {
|
171
|
+
someFunction : function() {
|
172
|
+
}
|
173
|
+
};
|
174
|
+
function efunc() {
|
175
|
+
this.spyOn(TestClass, 'someOtherFunction');
|
176
|
+
};
|
177
|
+
expect(function() {
|
178
|
+
efunc();
|
179
|
+
}).toThrow('someOtherFunction() method does not exist');
|
180
|
+
|
181
|
+
});
|
182
|
+
|
168
183
|
it('should be able to reset a spy', function() {
|
169
184
|
var TestClass = { someFunction: function() {} };
|
170
185
|
this.spyOn(TestClass, 'someFunction');
|
@@ -0,0 +1,39 @@
|
|
1
|
+
jasmine_dir:
|
2
|
+
- 'src'
|
3
|
+
#This 'magic' inclusion order allows the travis build to pass.
|
4
|
+
#TODO: search for the correct files to include to prevent
|
5
|
+
jasmine_files:
|
6
|
+
- 'core/base.js'
|
7
|
+
- 'core/util.js'
|
8
|
+
- 'core/Reporter.js'
|
9
|
+
#end of known dependencies
|
10
|
+
- 'core/Env.js'
|
11
|
+
- 'core/Block.js'
|
12
|
+
- 'core/JsApiReporter.js'
|
13
|
+
- 'core/Matchers.js'
|
14
|
+
- 'core/mock-timeout.js'
|
15
|
+
- 'core/MultiReporter.js'
|
16
|
+
- 'core/NestedResults.js'
|
17
|
+
- 'core/PrettyPrinter.js'
|
18
|
+
- 'core/Queue.js'
|
19
|
+
- 'core/Runner.js'
|
20
|
+
- 'core/Spec.js'
|
21
|
+
- 'core/Suite.js'
|
22
|
+
- 'core/WaitsBlock.js'
|
23
|
+
- 'core/WaitsForBlock.js'
|
24
|
+
- 'html/HtmlReporterHelpers.js'
|
25
|
+
- 'html/HtmlReporter.js'
|
26
|
+
- '**/*.js'
|
27
|
+
jasmine_css_files:
|
28
|
+
- 'html/jasmine.css'
|
29
|
+
src_files:
|
30
|
+
stylesheets:
|
31
|
+
helpers:
|
32
|
+
- 'helpers/**/*.js'
|
33
|
+
spec_files:
|
34
|
+
- '**/*[Ss]pec.js'
|
35
|
+
src_dir:
|
36
|
+
spec_dir:
|
37
|
+
- 'spec'
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'jasmine'
|
2
|
+
|
3
|
+
Jasmine.load_configuration_from_yaml(File.join(Dir.pwd, 'spec', 'jasmine.yml'))
|
4
|
+
config = Jasmine.config
|
5
|
+
server = Jasmine::Server.new(config.port, Jasmine::Application.app(config))
|
6
|
+
driver = Jasmine::SeleniumDriver.new(config.browser, "#{config.host}:#{config.port}/")
|
7
|
+
|
8
|
+
t = Thread.new do
|
9
|
+
begin
|
10
|
+
server.start
|
11
|
+
rescue ChildProcess::TimeoutError
|
12
|
+
end
|
13
|
+
# # ignore bad exits
|
14
|
+
end
|
15
|
+
t.abort_on_exception = true
|
16
|
+
Jasmine::wait_for_listener(config.port, "jasmine server")
|
17
|
+
puts "jasmine server started."
|
18
|
+
|
19
|
+
results_processor = Jasmine::ResultsProcessor.new(config)
|
20
|
+
results = Jasmine::Runners::HTTP.new(driver, results_processor, config.result_batch_size).run
|
21
|
+
formatter = Jasmine::RspecFormatter.new
|
22
|
+
formatter.format_results(results)
|
23
|
+
|
@@ -36,34 +36,25 @@ describe "Build Github Pages task" do
|
|
36
36
|
@output.should match(/Building Github Pages/)
|
37
37
|
end
|
38
38
|
|
39
|
-
it "should
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
it "should build the pages output to the requested diretory" do
|
44
|
-
Dir.chdir File.join(pages_dir, 'pages_output') do
|
45
|
-
pages = Dir.glob(File.join('**', '*'))
|
39
|
+
it "should copy the latest jasmine files to the pages dir" do
|
40
|
+
['jasmine.js', 'jasmine.css', 'jasmine-html.js'].each do |lib_file|
|
41
|
+
source = File.read(File.join(project_root, 'lib', 'jasmine-core', lib_file))
|
42
|
+
dest = File.read(File.join(pages_dir, 'lib', lib_file))
|
46
43
|
|
47
|
-
|
48
|
-
pages.should include('index.html')
|
49
|
-
pages.should include(File.join('images', 'jasmine_logo.png'))
|
50
|
-
pages.should include(File.join('images', 'pivotal_logo.gif'))
|
51
|
-
pages.should include(File.join('css', 'pygments.css'))
|
52
|
-
pages.should include(File.join('css', 'screen.css'))
|
44
|
+
source.should == dest
|
53
45
|
end
|
54
46
|
end
|
55
47
|
|
56
|
-
it "should
|
57
|
-
|
58
|
-
|
48
|
+
it "should build a new page" do
|
49
|
+
@output.should match(/rocco/)
|
50
|
+
File.exist?(File.join(pages_dir, 'introduction.html')).should be_true
|
51
|
+
end
|
59
52
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
pages.should include(File.join('css', 'screen.css'))
|
66
|
-
end
|
53
|
+
it "should copy the rocco output to index.html" do
|
54
|
+
introduction = File.read(File.join(pages_dir, 'introduction.html'))
|
55
|
+
index = File.read(File.join(pages_dir, 'index.html'))
|
56
|
+
|
57
|
+
index.should == introduction
|
67
58
|
end
|
68
59
|
end
|
69
60
|
end
|
@@ -12,11 +12,16 @@ jasmine.Block = function(env, func, spec) {
|
|
12
12
|
this.spec = spec;
|
13
13
|
};
|
14
14
|
|
15
|
-
jasmine.Block.prototype.execute = function(onComplete) {
|
16
|
-
|
15
|
+
jasmine.Block.prototype.execute = function(onComplete) {
|
16
|
+
if (!jasmine.CATCH_EXCEPTIONS) {
|
17
17
|
this.func.apply(this.spec);
|
18
|
-
}
|
19
|
-
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
try {
|
21
|
+
this.func.apply(this.spec);
|
22
|
+
} catch (e) {
|
23
|
+
this.spec.fail(e);
|
24
|
+
}
|
20
25
|
}
|
21
26
|
onComplete();
|
22
27
|
};
|
data/lib/jasmine/src/core/Env.js
CHANGED
@@ -168,6 +168,25 @@ jasmine.Env.prototype.xit = function(desc, func) {
|
|
168
168
|
};
|
169
169
|
};
|
170
170
|
|
171
|
+
jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) {
|
172
|
+
if (a.source != b.source)
|
173
|
+
mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/");
|
174
|
+
|
175
|
+
if (a.ignoreCase != b.ignoreCase)
|
176
|
+
mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier");
|
177
|
+
|
178
|
+
if (a.global != b.global)
|
179
|
+
mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier");
|
180
|
+
|
181
|
+
if (a.multiline != b.multiline)
|
182
|
+
mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier");
|
183
|
+
|
184
|
+
if (a.sticky != b.sticky)
|
185
|
+
mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier");
|
186
|
+
|
187
|
+
return (mismatchValues.length === 0);
|
188
|
+
};
|
189
|
+
|
171
190
|
jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
|
172
191
|
if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
|
173
192
|
return true;
|
@@ -254,6 +273,10 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
|
254
273
|
return (a == b);
|
255
274
|
}
|
256
275
|
|
276
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
277
|
+
return this.compareRegExps_(a, b, mismatchKeys, mismatchValues);
|
278
|
+
}
|
279
|
+
|
257
280
|
if (typeof a === "object" && typeof b === "object") {
|
258
281
|
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
259
282
|
}
|
@@ -150,6 +150,17 @@ jasmine.Matchers.prototype.toBeNull = function() {
|
|
150
150
|
return (this.actual === null);
|
151
151
|
};
|
152
152
|
|
153
|
+
/**
|
154
|
+
* Matcher that compares the actual to NaN.
|
155
|
+
*/
|
156
|
+
jasmine.Matchers.prototype.toBeNaN = function() {
|
157
|
+
this.message = function() {
|
158
|
+
return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ];
|
159
|
+
};
|
160
|
+
|
161
|
+
return (this.actual !== this.actual);
|
162
|
+
};
|
163
|
+
|
153
164
|
/**
|
154
165
|
* Matcher that boolean not-nots the actual.
|
155
166
|
*/
|
@@ -227,18 +238,14 @@ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
|
|
227
238
|
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
228
239
|
}
|
229
240
|
this.message = function() {
|
241
|
+
var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was.";
|
242
|
+
var positiveMessage = "";
|
230
243
|
if (this.actual.callCount === 0) {
|
231
|
-
|
232
|
-
return [
|
233
|
-
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
|
234
|
-
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
|
235
|
-
];
|
244
|
+
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
|
236
245
|
} else {
|
237
|
-
|
238
|
-
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
|
239
|
-
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
|
240
|
-
];
|
246
|
+
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '')
|
241
247
|
}
|
248
|
+
return [positiveMessage, invertedMessage];
|
242
249
|
};
|
243
250
|
|
244
251
|
return this.env.contains_(this.actual.argsForCall, expectedArgs);
|
@@ -296,22 +303,19 @@ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
|
296
303
|
* up to a given level of decimal precision (default 2).
|
297
304
|
*
|
298
305
|
* @param {Number} expected
|
299
|
-
* @param {Number} precision
|
306
|
+
* @param {Number} precision, as number of decimal places
|
300
307
|
*/
|
301
308
|
jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
|
302
309
|
if (!(precision === 0)) {
|
303
310
|
precision = precision || 2;
|
304
311
|
}
|
305
|
-
|
306
|
-
var actual = Math.round(this.actual * multiplier);
|
307
|
-
expected = Math.round(expected * multiplier);
|
308
|
-
return expected == actual;
|
312
|
+
return Math.abs(expected - this.actual) < (Math.pow(10, -precision) / 2);
|
309
313
|
};
|
310
314
|
|
311
315
|
/**
|
312
316
|
* Matcher that checks that the expected exception was thrown by the actual.
|
313
317
|
*
|
314
|
-
* @param {String} expected
|
318
|
+
* @param {String} [expected]
|
315
319
|
*/
|
316
320
|
jasmine.Matchers.prototype.toThrow = function(expected) {
|
317
321
|
var result = false;
|
@@ -11,10 +11,6 @@ jasmine.PrettyPrinter = function() {
|
|
11
11
|
* @param value
|
12
12
|
*/
|
13
13
|
jasmine.PrettyPrinter.prototype.format = function(value) {
|
14
|
-
if (this.ppNestLevel_ > 40) {
|
15
|
-
throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
|
16
|
-
}
|
17
|
-
|
18
14
|
this.ppNestLevel_++;
|
19
15
|
try {
|
20
16
|
if (value === jasmine.undefined) {
|
@@ -57,6 +53,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|
57
53
|
|
58
54
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
59
55
|
for (var property in obj) {
|
56
|
+
if (!obj.hasOwnProperty(property)) continue;
|
60
57
|
if (property == '__Jasmine_been_here_before__') continue;
|
61
58
|
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
62
59
|
obj.__lookupGetter__(property) !== null) : false);
|
@@ -84,6 +81,11 @@ jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
|
|
84
81
|
};
|
85
82
|
|
86
83
|
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
84
|
+
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
85
|
+
this.append("Array");
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
87
89
|
this.append('[ ');
|
88
90
|
for (var i = 0; i < array.length; i++) {
|
89
91
|
if (i > 0) {
|
@@ -95,6 +97,11 @@ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
|
95
97
|
};
|
96
98
|
|
97
99
|
jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
|
100
|
+
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
101
|
+
this.append("Object");
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
|
98
105
|
var self = this;
|
99
106
|
this.append('{ ');
|
100
107
|
var first = true;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
jasmine.Queue = function(env) {
|
2
2
|
this.env = env;
|
3
|
+
|
4
|
+
// parallel to blocks. each true value in this array means the block will
|
5
|
+
// get executed even if we abort
|
6
|
+
this.ensured = [];
|
3
7
|
this.blocks = [];
|
4
8
|
this.running = false;
|
5
9
|
this.index = 0;
|
@@ -7,15 +11,30 @@ jasmine.Queue = function(env) {
|
|
7
11
|
this.abort = false;
|
8
12
|
};
|
9
13
|
|
10
|
-
jasmine.Queue.prototype.addBefore = function(block) {
|
14
|
+
jasmine.Queue.prototype.addBefore = function(block, ensure) {
|
15
|
+
if (ensure === jasmine.undefined) {
|
16
|
+
ensure = false;
|
17
|
+
}
|
18
|
+
|
11
19
|
this.blocks.unshift(block);
|
20
|
+
this.ensured.unshift(ensure);
|
12
21
|
};
|
13
22
|
|
14
|
-
jasmine.Queue.prototype.add = function(block) {
|
23
|
+
jasmine.Queue.prototype.add = function(block, ensure) {
|
24
|
+
if (ensure === jasmine.undefined) {
|
25
|
+
ensure = false;
|
26
|
+
}
|
27
|
+
|
15
28
|
this.blocks.push(block);
|
29
|
+
this.ensured.push(ensure);
|
16
30
|
};
|
17
31
|
|
18
|
-
jasmine.Queue.prototype.insertNext = function(block) {
|
32
|
+
jasmine.Queue.prototype.insertNext = function(block, ensure) {
|
33
|
+
if (ensure === jasmine.undefined) {
|
34
|
+
ensure = false;
|
35
|
+
}
|
36
|
+
|
37
|
+
this.ensured.splice((this.index + this.offset + 1), 0, ensure);
|
19
38
|
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
20
39
|
this.offset++;
|
21
40
|
};
|
@@ -39,7 +58,7 @@ jasmine.Queue.prototype.next_ = function() {
|
|
39
58
|
while (goAgain) {
|
40
59
|
goAgain = false;
|
41
60
|
|
42
|
-
if (self.index < self.blocks.length && !this.abort) {
|
61
|
+
if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) {
|
43
62
|
var calledSynchronously = true;
|
44
63
|
var completedSynchronously = false;
|
45
64
|
|
@@ -154,7 +154,7 @@ jasmine.Spec.prototype.finish = function(onComplete) {
|
|
154
154
|
|
155
155
|
jasmine.Spec.prototype.after = function(doAfter) {
|
156
156
|
if (this.queue.isRunning()) {
|
157
|
-
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
157
|
+
this.queue.add(new jasmine.Block(this.env, doAfter, this), true);
|
158
158
|
} else {
|
159
159
|
this.afterCallbacks.unshift(doAfter);
|
160
160
|
}
|
@@ -192,15 +192,15 @@ jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
|
192
192
|
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
|
193
193
|
}
|
194
194
|
for (i = 0; i < this.afterCallbacks.length; i++) {
|
195
|
-
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
|
195
|
+
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this), true);
|
196
196
|
}
|
197
197
|
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
198
198
|
for (i = 0; i < suite.after_.length; i++) {
|
199
|
-
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
|
199
|
+
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this), true);
|
200
200
|
}
|
201
201
|
}
|
202
202
|
for (i = 0; i < runner.after_.length; i++) {
|
203
|
-
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
|
203
|
+
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this), true);
|
204
204
|
}
|
205
205
|
};
|
206
206
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var isCommonJS = typeof window == "undefined";
|
1
|
+
var isCommonJS = typeof window == "undefined" && typeof exports == "object";
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
@@ -34,11 +34,23 @@ jasmine.VERBOSE = false;
|
|
34
34
|
*/
|
35
35
|
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
36
36
|
|
37
|
+
/**
|
38
|
+
* Maximum levels of nesting that will be included when an object is pretty-printed
|
39
|
+
*/
|
40
|
+
jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
|
41
|
+
|
37
42
|
/**
|
38
43
|
* Default timeout interval in milliseconds for waitsFor() blocks.
|
39
44
|
*/
|
40
45
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
41
46
|
|
47
|
+
/**
|
48
|
+
* By default exceptions thrown in the context of a test are caught by jasmine so that it can run the remaining tests in the suite.
|
49
|
+
* Set to false to let the exception bubble up in the browser.
|
50
|
+
*
|
51
|
+
*/
|
52
|
+
jasmine.CATCH_EXCEPTIONS = true;
|
53
|
+
|
42
54
|
jasmine.getGlobal = function() {
|
43
55
|
function getGlobal() {
|
44
56
|
return this;
|
@@ -463,7 +475,7 @@ jasmine.log = function() {
|
|
463
475
|
* @see jasmine.createSpy
|
464
476
|
* @param obj
|
465
477
|
* @param methodName
|
466
|
-
* @
|
478
|
+
* @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods
|
467
479
|
*/
|
468
480
|
var spyOn = function(obj, methodName) {
|
469
481
|
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
@@ -508,6 +520,7 @@ if (isCommonJS) exports.xit = xit;
|
|
508
520
|
* jasmine.Matchers functions.
|
509
521
|
*
|
510
522
|
* @param {Object} actual Actual value to test against and expected value
|
523
|
+
* @return {jasmine.Matchers}
|
511
524
|
*/
|
512
525
|
var expect = function(actual) {
|
513
526
|
return jasmine.getEnv().currentSpec.expect(actual);
|
@@ -18,6 +18,7 @@ jasmine.HtmlReporter = function(_doc) {
|
|
18
18
|
|
19
19
|
createReporterDom(runner.env.versionString());
|
20
20
|
doc.body.appendChild(dom.reporter);
|
21
|
+
setExceptionHandling();
|
21
22
|
|
22
23
|
reporterView = new jasmine.HtmlReporter.ReporterView(dom);
|
23
24
|
reporterView.addSpecs(specs, self.specFilter);
|
@@ -71,7 +72,7 @@ jasmine.HtmlReporter = function(_doc) {
|
|
71
72
|
}
|
72
73
|
|
73
74
|
var paramMap = [];
|
74
|
-
var params =
|
75
|
+
var params = jasmine.HtmlReporter.parameters(doc);
|
75
76
|
|
76
77
|
for (var i = 0; i < params.length; i++) {
|
77
78
|
var p = params[i].split('=');
|
@@ -91,11 +92,74 @@ jasmine.HtmlReporter = function(_doc) {
|
|
91
92
|
self.createDom('span', { className: 'version' }, version)),
|
92
93
|
|
93
94
|
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
|
94
|
-
dom.alert = self.createDom('div', {className: 'alert'}
|
95
|
+
dom.alert = self.createDom('div', {className: 'alert'},
|
96
|
+
self.createDom('span', { className: 'exceptions' },
|
97
|
+
self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'),
|
98
|
+
self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
|
95
99
|
dom.results = self.createDom('div', {className: 'results'},
|
96
100
|
dom.summary = self.createDom('div', { className: 'summary' }),
|
97
101
|
dom.details = self.createDom('div', { id: 'details' }))
|
98
102
|
);
|
99
103
|
}
|
104
|
+
|
105
|
+
function noTryCatch() {
|
106
|
+
return window.location.search.match(/catch=false/);
|
107
|
+
}
|
108
|
+
|
109
|
+
function searchWithCatch() {
|
110
|
+
var params = jasmine.HtmlReporter.parameters(window.document);
|
111
|
+
var removed = false;
|
112
|
+
var i = 0;
|
113
|
+
|
114
|
+
while (!removed && i < params.length) {
|
115
|
+
if (params[i].match(/catch=/)) {
|
116
|
+
params.splice(i, 1);
|
117
|
+
removed = true;
|
118
|
+
}
|
119
|
+
i++;
|
120
|
+
}
|
121
|
+
if (jasmine.CATCH_EXCEPTIONS) {
|
122
|
+
params.push("catch=false");
|
123
|
+
}
|
124
|
+
|
125
|
+
return params.join("&");
|
126
|
+
}
|
127
|
+
|
128
|
+
function setExceptionHandling() {
|
129
|
+
var chxCatch = document.getElementById('no_try_catch');
|
130
|
+
|
131
|
+
if (noTryCatch()) {
|
132
|
+
chxCatch.setAttribute('checked', true);
|
133
|
+
jasmine.CATCH_EXCEPTIONS = false;
|
134
|
+
}
|
135
|
+
chxCatch.onclick = function() {
|
136
|
+
window.location.search = searchWithCatch();
|
137
|
+
};
|
138
|
+
}
|
139
|
+
};
|
140
|
+
jasmine.HtmlReporter.parameters = function(doc) {
|
141
|
+
var paramStr = doc.location.search.substring(1);
|
142
|
+
var params = [];
|
143
|
+
|
144
|
+
if (paramStr.length > 0) {
|
145
|
+
params = paramStr.split('&');
|
146
|
+
}
|
147
|
+
return params;
|
148
|
+
}
|
149
|
+
jasmine.HtmlReporter.sectionLink = function(sectionName) {
|
150
|
+
var link = '?';
|
151
|
+
var params = [];
|
152
|
+
|
153
|
+
if (sectionName) {
|
154
|
+
params.push('spec=' + encodeURIComponent(sectionName));
|
155
|
+
}
|
156
|
+
if (!jasmine.CATCH_EXCEPTIONS) {
|
157
|
+
params.push("catch=false");
|
158
|
+
}
|
159
|
+
if (params.length > 0) {
|
160
|
+
link += params.join("&");
|
161
|
+
}
|
162
|
+
|
163
|
+
return link;
|
100
164
|
};
|
101
|
-
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
|
165
|
+
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
|