jasmine-core 2.0.0.rc3 → 2.0.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/console/console.js +160 -0
- data/lib/jasmine-core/boot.js +84 -8
- data/lib/jasmine-core/boot/boot.js +84 -8
- data/lib/jasmine-core/jasmine-html.js +6 -3
- data/lib/jasmine-core/jasmine.js +236 -260
- data/lib/jasmine-core/spec/core/AnySpec.js +1 -1
- data/lib/jasmine-core/spec/core/ClockSpec.js +0 -20
- data/lib/jasmine-core/spec/core/CustomMatchersSpec.js +149 -96
- data/lib/jasmine-core/spec/core/EnvSpec.js +7 -39
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +13 -19
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +74 -1
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -1
- data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +1 -1
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +28 -20
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +1 -1
- data/lib/jasmine-core/spec/core/SpecRunningSpec.js +0 -1
- data/lib/jasmine-core/spec/core/SpecSpec.js +2 -11
- data/lib/jasmine-core/spec/core/SuiteSpec.js +2 -50
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +13 -1
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +4 -4
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +3 -2
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +1 -1
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -1
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +1 -1
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +1 -1
- data/lib/jasmine-core/spec/node_suite.js +13 -11
- data/lib/jasmine-core/spec/support/dev_boot.js +17 -6
- data/lib/jasmine-core/version.rb +1 -1
- metadata +41 -13
- checksums.yaml +0 -7
@@ -36,11 +36,20 @@ describe("QueueRunner", function() {
|
|
36
36
|
expect(asyncContext).toBe(context);
|
37
37
|
});
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
describe("with an asynchronous function", function() {
|
40
|
+
beforeEach(function() {
|
41
|
+
jasmine.clock().install();
|
42
|
+
});
|
43
|
+
|
44
|
+
afterEach(function() {
|
45
|
+
jasmine.clock().uninstall();
|
46
|
+
});
|
47
|
+
|
48
|
+
it("supports asynchronous functions, only advancing to next function after a done() callback", function() {
|
49
|
+
//TODO: it would be nice if spy arity could match the fake, so we could do something like:
|
50
|
+
//createSpy('asyncfn').and.callFake(function(done) {});
|
42
51
|
|
43
|
-
|
52
|
+
var onComplete = jasmine.createSpy('onComplete'),
|
44
53
|
beforeCallback = jasmine.createSpy('beforeCallback'),
|
45
54
|
fnCallback = jasmine.createSpy('fnCallback'),
|
46
55
|
afterCallback = jasmine.createSpy('afterCallback'),
|
@@ -67,29 +76,28 @@ describe("QueueRunner", function() {
|
|
67
76
|
onComplete: onComplete
|
68
77
|
});
|
69
78
|
|
70
|
-
|
79
|
+
queueRunner.execute();
|
71
80
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
expect(afterCallback).not.toHaveBeenCalled();
|
77
|
-
expect(onComplete).not.toHaveBeenCalled();
|
81
|
+
expect(beforeCallback).toHaveBeenCalled();
|
82
|
+
expect(fnCallback).not.toHaveBeenCalled();
|
83
|
+
expect(afterCallback).not.toHaveBeenCalled();
|
84
|
+
expect(onComplete).not.toHaveBeenCalled();
|
78
85
|
|
79
|
-
|
86
|
+
jasmine.clock().tick(100);
|
80
87
|
|
81
|
-
|
82
|
-
|
83
|
-
|
88
|
+
expect(fnCallback).toHaveBeenCalled();
|
89
|
+
expect(afterCallback).not.toHaveBeenCalled();
|
90
|
+
expect(onComplete).not.toHaveBeenCalled();
|
84
91
|
|
85
|
-
|
92
|
+
jasmine.clock().tick(100);
|
86
93
|
|
87
|
-
|
88
|
-
|
94
|
+
expect(afterCallback).toHaveBeenCalled();
|
95
|
+
expect(onComplete).not.toHaveBeenCalled();
|
89
96
|
|
90
|
-
|
97
|
+
jasmine.clock().tick(100);
|
91
98
|
|
92
|
-
|
99
|
+
expect(onComplete).toHaveBeenCalled();
|
100
|
+
});
|
93
101
|
});
|
94
102
|
|
95
103
|
it("calls an exception handler when an exception is thrown in a fn", function() {
|
@@ -189,18 +189,9 @@ describe("Spec", function() {
|
|
189
189
|
expect(done).toHaveBeenCalled();
|
190
190
|
});
|
191
191
|
|
192
|
-
it("#status returns
|
192
|
+
it("#status returns passing by default", function() {
|
193
193
|
var spec = new j$.Spec({fn: jasmine.createSpy("spec body")});
|
194
|
-
expect(spec.status()).toEqual('
|
195
|
-
});
|
196
|
-
|
197
|
-
it("#status returns pending if no expectations were encountered", function() {
|
198
|
-
var specBody = jasmine.createSpy("spec body"),
|
199
|
-
spec = new j$.Spec({fn: specBody});
|
200
|
-
|
201
|
-
spec.execute();
|
202
|
-
|
203
|
-
expect(spec.status()).toEqual('pending');
|
194
|
+
expect(spec.status()).toEqual('passed');
|
204
195
|
});
|
205
196
|
|
206
197
|
it("#status returns passed if all expectations in the spec have passed", function() {
|
@@ -67,54 +67,6 @@ describe("Suite", function() {
|
|
67
67
|
expect(suite.afterFns).toEqual([innerAfter, outerAfter]);
|
68
68
|
});
|
69
69
|
|
70
|
-
it("adds specs", function() {
|
71
|
-
var env = new j$.Env(),
|
72
|
-
fakeQueue = {
|
73
|
-
add: jasmine.createSpy()
|
74
|
-
},
|
75
|
-
suite = new j$.Suite({
|
76
|
-
env: env,
|
77
|
-
description: "I am a suite",
|
78
|
-
queueFactory: function() {
|
79
|
-
return fakeQueue
|
80
|
-
}
|
81
|
-
}),
|
82
|
-
fakeSpec = {};
|
83
|
-
|
84
|
-
expect(suite.specs.length).toEqual(0);
|
85
|
-
|
86
|
-
suite.addSpec(fakeSpec);
|
87
|
-
|
88
|
-
expect(suite.specs.length).toEqual(1);
|
89
|
-
});
|
90
|
-
|
91
|
-
it("adds suites", function() {
|
92
|
-
var env = new j$.Env(),
|
93
|
-
fakeQueue = {
|
94
|
-
add: jasmine.createSpy()
|
95
|
-
},
|
96
|
-
suite = new j$.Suite({
|
97
|
-
env: env,
|
98
|
-
description: "I am a suite",
|
99
|
-
queueFactory: function() {
|
100
|
-
return fakeQueue
|
101
|
-
}
|
102
|
-
}),
|
103
|
-
anotherSuite = new j$.Suite({
|
104
|
-
env: env,
|
105
|
-
description: "I am another suite",
|
106
|
-
queueFactory: function() {
|
107
|
-
return fakeQueue
|
108
|
-
}
|
109
|
-
});
|
110
|
-
|
111
|
-
expect(suite.suites.length).toEqual(0);
|
112
|
-
|
113
|
-
suite.addSuite(anotherSuite);
|
114
|
-
|
115
|
-
expect(suite.suites.length).toEqual(1);
|
116
|
-
});
|
117
|
-
|
118
70
|
it("can be disabled", function() {
|
119
71
|
var env = new j$.Env(),
|
120
72
|
fakeQueueRunner = jasmine.createSpy('fake queue runner'),
|
@@ -154,8 +106,8 @@ describe("Suite", function() {
|
|
154
106
|
|
155
107
|
spyOn(suite, "execute");
|
156
108
|
|
157
|
-
parentSuite.
|
158
|
-
parentSuite.
|
109
|
+
parentSuite.addChild(fakeSpec1);
|
110
|
+
parentSuite.addChild(suite);
|
159
111
|
|
160
112
|
parentSuite.execute(parentSuiteDone);
|
161
113
|
|
@@ -153,10 +153,22 @@ describe("matchersUtil", function() {
|
|
153
153
|
expect(j$.matchersUtil.equals(1, 2, [tester])).toBe(true);
|
154
154
|
});
|
155
155
|
|
156
|
+
it("passes for two empty Objects", function () {
|
157
|
+
expect(j$.matchersUtil.equals({}, {})).toBe(true);
|
158
|
+
});
|
159
|
+
|
160
|
+
describe("when a custom equality matcher is installed that returns 'undefined'", function () {
|
161
|
+
var tester = function(a, b) { return jasmine.undefined; };
|
162
|
+
|
163
|
+
it("passes for two empty Objects", function () {
|
164
|
+
expect(j$.matchersUtil.equals({}, {}, [tester])).toBe(true);
|
165
|
+
});
|
166
|
+
});
|
167
|
+
|
156
168
|
it("fails for equivalents when a custom equality matcher returns false", function() {
|
157
169
|
var tester = function(a, b) { return false; };
|
158
170
|
|
159
|
-
expect(j$.matchersUtil.equals(1,
|
171
|
+
expect(j$.matchersUtil.equals(1, 1, [tester])).toBe(false);
|
160
172
|
});
|
161
173
|
});
|
162
174
|
|
@@ -4,7 +4,7 @@ describe("toThrowError", function() {
|
|
4
4
|
|
5
5
|
expect(function() {
|
6
6
|
matcher.compare({});
|
7
|
-
}).
|
7
|
+
}).toThrowError("Actual is not a Function");
|
8
8
|
});
|
9
9
|
|
10
10
|
it("throws an error when the expected is not an Error, string, or RegExp", function() {
|
@@ -15,7 +15,7 @@ describe("toThrowError", function() {
|
|
15
15
|
|
16
16
|
expect(function() {
|
17
17
|
matcher.compare(fn, 1);
|
18
|
-
}).
|
18
|
+
}).toThrowError("Expected is not an Error, string, or RegExp.");
|
19
19
|
});
|
20
20
|
|
21
21
|
it("throws an error when the expected error type is not an Error", function() {
|
@@ -26,7 +26,7 @@ describe("toThrowError", function() {
|
|
26
26
|
|
27
27
|
expect(function() {
|
28
28
|
matcher.compare(fn, void 0, "foo");
|
29
|
-
}).
|
29
|
+
}).toThrowError("Expected error type is not an Error.");
|
30
30
|
});
|
31
31
|
|
32
32
|
it("throws an error when the expected error message is not a string or RegExp", function() {
|
@@ -37,7 +37,7 @@ describe("toThrowError", function() {
|
|
37
37
|
|
38
38
|
expect(function() {
|
39
39
|
matcher.compare(fn, Error, 1);
|
40
|
-
}).
|
40
|
+
}).toThrowError("Expected error message is not a string or RegExp.");
|
41
41
|
});
|
42
42
|
|
43
43
|
it("fails if actual does not throw at all", function() {
|
@@ -4,7 +4,8 @@ describe("toThrow", function() {
|
|
4
4
|
|
5
5
|
expect(function() {
|
6
6
|
matcher.compare({});
|
7
|
-
|
7
|
+
matcherComparator({});
|
8
|
+
}).toThrowError("Actual is not a Function");
|
8
9
|
});
|
9
10
|
|
10
11
|
it("fails if actual does not throw", function() {
|
@@ -95,4 +96,4 @@ describe("toThrow", function() {
|
|
95
96
|
expect(result.pass).toBe(false);
|
96
97
|
expect(result.message).toEqual("Expected function to throw undefined, but it threw 5.");
|
97
98
|
});
|
98
|
-
});
|
99
|
+
});
|
@@ -6,7 +6,7 @@ var path = require('path');
|
|
6
6
|
var jasmineRequire = require('../lib/jasmine-core/jasmine.js');
|
7
7
|
var jasmine = jasmineRequire.core(jasmineRequire);
|
8
8
|
|
9
|
-
var consoleFns = require('../
|
9
|
+
var consoleFns = require('../lib/console/console.js');
|
10
10
|
extend(jasmineRequire, consoleFns);
|
11
11
|
jasmineRequire.console(jasmineRequire, jasmine);
|
12
12
|
|
@@ -41,20 +41,10 @@ var jasmineInterface = {
|
|
41
41
|
return env.expect(actual);
|
42
42
|
},
|
43
43
|
|
44
|
-
addMatchers: function(matchers) {
|
45
|
-
return env.addMatchers(matchers);
|
46
|
-
},
|
47
|
-
|
48
44
|
spyOn: function(obj, methodName) {
|
49
45
|
return env.spyOn(obj, methodName);
|
50
46
|
},
|
51
47
|
|
52
|
-
clock: env.clock,
|
53
|
-
setTimeout: env.clock.setTimeout,
|
54
|
-
clearTimeout: env.clock.clearTimeout,
|
55
|
-
setInterval: env.clock.setInterval,
|
56
|
-
clearInterval: env.clock.clearInterval,
|
57
|
-
|
58
48
|
jsApiReporter: new jasmine.JsApiReporter({
|
59
49
|
timer: new jasmine.Timer()
|
60
50
|
})
|
@@ -67,6 +57,18 @@ function extend(destination, source) {
|
|
67
57
|
return destination;
|
68
58
|
}
|
69
59
|
|
60
|
+
jasmine.addCustomEqualityTester = function(tester) {
|
61
|
+
env.addCustomEqualityTester(tester);
|
62
|
+
};
|
63
|
+
|
64
|
+
jasmine.addMatchers = function(matchers) {
|
65
|
+
return env.addMatchers(matchers);
|
66
|
+
};
|
67
|
+
|
68
|
+
jasmine.clock = function() {
|
69
|
+
return env.clock;
|
70
|
+
};
|
71
|
+
|
70
72
|
// Jasmine "runner"
|
71
73
|
function executeSpecs(specs, done, isVerbose, showColors) {
|
72
74
|
global.jasmine = jasmine;
|
@@ -39,15 +39,10 @@
|
|
39
39
|
return env.pending();
|
40
40
|
},
|
41
41
|
|
42
|
-
addMatchers: function(matchers) {
|
43
|
-
return env.addMatchers(matchers);
|
44
|
-
},
|
45
|
-
|
46
42
|
spyOn: function(obj, methodName) {
|
47
43
|
return env.spyOn(obj, methodName);
|
48
44
|
},
|
49
45
|
|
50
|
-
clock: env.clock,
|
51
46
|
jsApiReporter: new jasmine.JsApiReporter({
|
52
47
|
timer: new jasmine.Timer()
|
53
48
|
})
|
@@ -59,6 +54,18 @@
|
|
59
54
|
extend(window, jasmineInterface);
|
60
55
|
}
|
61
56
|
|
57
|
+
jasmine.addCustomEqualityTester = function(tester) {
|
58
|
+
env.addCustomEqualityTester(tester);
|
59
|
+
};
|
60
|
+
|
61
|
+
jasmine.addMatchers = function(matchers) {
|
62
|
+
return env.addMatchers(matchers);
|
63
|
+
};
|
64
|
+
|
65
|
+
jasmine.clock = function() {
|
66
|
+
return env.clock;
|
67
|
+
};
|
68
|
+
|
62
69
|
var queryString = new jasmine.QueryString({
|
63
70
|
getWindowLocation: function() { return window.location; }
|
64
71
|
});
|
@@ -69,7 +76,6 @@
|
|
69
76
|
|
70
77
|
var htmlReporter = new jasmine.HtmlReporter({
|
71
78
|
env: env,
|
72
|
-
queryString: queryString,
|
73
79
|
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
|
74
80
|
getContainer: function() { return document.body; },
|
75
81
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -88,6 +94,11 @@
|
|
88
94
|
return specFilter.matches(spec.getFullName());
|
89
95
|
};
|
90
96
|
|
97
|
+
window.setTimeout = window.setTimeout;
|
98
|
+
window.setInterval = window.setInterval;
|
99
|
+
window.clearTimeout = window.clearTimeout;
|
100
|
+
window.clearInterval = window.clearInterval;
|
101
|
+
|
91
102
|
var currentWindowOnload = window.onload;
|
92
103
|
|
93
104
|
window.onload = function() {
|
data/lib/jasmine-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc5
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Rajan Agaskar
|
@@ -10,48 +11,70 @@ authors:
|
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2013-10-
|
14
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rake
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
18
20
|
requirements:
|
19
|
-
- - '>='
|
21
|
+
- - ! '>='
|
20
22
|
- !ruby/object:Gem::Version
|
21
23
|
version: '0'
|
22
24
|
type: :development
|
23
25
|
prerelease: false
|
24
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
25
28
|
requirements:
|
26
|
-
- - '>='
|
29
|
+
- - ! '>='
|
27
30
|
- !ruby/object:Gem::Version
|
28
31
|
version: '0'
|
29
32
|
- !ruby/object:Gem::Dependency
|
30
33
|
name: sauce-connect
|
31
34
|
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
32
36
|
requirements:
|
33
|
-
- - '>='
|
37
|
+
- - ! '>='
|
34
38
|
- !ruby/object:Gem::Version
|
35
39
|
version: '0'
|
36
40
|
type: :development
|
37
41
|
prerelease: false
|
38
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
39
44
|
requirements:
|
40
|
-
- - '>='
|
45
|
+
- - ! '>='
|
41
46
|
- !ruby/object:Gem::Version
|
42
47
|
version: '0'
|
43
48
|
- !ruby/object:Gem::Dependency
|
44
49
|
name: jasmine_selenium_runner
|
45
50
|
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
46
52
|
requirements:
|
47
|
-
- - '>='
|
53
|
+
- - ! '>='
|
48
54
|
- !ruby/object:Gem::Version
|
49
55
|
version: '0'
|
50
56
|
type: :development
|
51
57
|
prerelease: false
|
52
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
53
60
|
requirements:
|
54
|
-
- - '>='
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: compass
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
type: :development
|
73
|
+
prerelease: false
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
55
78
|
- !ruby/object:Gem::Version
|
56
79
|
version: '0'
|
57
80
|
description: Test your JavaScript without any framework dependencies, in any environment,
|
@@ -61,6 +84,7 @@ executables: []
|
|
61
84
|
extensions: []
|
62
85
|
extra_rdoc_files: []
|
63
86
|
files:
|
87
|
+
- ./lib/console/console.js
|
64
88
|
- ./lib/jasmine-core/boot/boot.js
|
65
89
|
- ./lib/jasmine-core/boot.js
|
66
90
|
- ./lib/jasmine-core/example/spec/PlayerSpec.js
|
@@ -127,25 +151,29 @@ files:
|
|
127
151
|
homepage: http://pivotal.github.com/jasmine
|
128
152
|
licenses:
|
129
153
|
- MIT
|
130
|
-
metadata: {}
|
131
154
|
post_install_message:
|
132
155
|
rdoc_options: []
|
133
156
|
require_paths:
|
134
157
|
- lib
|
135
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
136
160
|
requirements:
|
137
|
-
- - '>='
|
161
|
+
- - ! '>='
|
138
162
|
- !ruby/object:Gem::Version
|
139
163
|
version: '0'
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
hash: -465958554793183644
|
140
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
none: false
|
141
169
|
requirements:
|
142
|
-
- - '>'
|
170
|
+
- - ! '>'
|
143
171
|
- !ruby/object:Gem::Version
|
144
172
|
version: 1.3.1
|
145
173
|
requirements: []
|
146
174
|
rubyforge_project: jasmine-core
|
147
|
-
rubygems_version:
|
175
|
+
rubygems_version: 1.8.25
|
148
176
|
signing_key:
|
149
|
-
specification_version:
|
177
|
+
specification_version: 3
|
150
178
|
summary: JavaScript BDD framework
|
151
179
|
test_files: []
|