jasmine-core 2.4.1 → 2.5.0
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.
- checksums.yaml +4 -4
- data/lib/console/console.js +1 -1
- data/lib/jasmine-core/boot.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +15 -7
- data/lib/jasmine-core/jasmine.js +261 -82
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +16 -16
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +26 -11
- data/lib/jasmine-core/spec/core/ClockSpec.js +61 -42
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +28 -15
- data/lib/jasmine-core/spec/core/EnvSpec.js +8 -8
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +6 -6
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +1 -1
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +8 -8
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +17 -17
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +14 -14
- data/lib/jasmine-core/spec/core/MockDateSpec.js +14 -14
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +65 -56
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +32 -18
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +27 -3
- data/lib/jasmine-core/spec/core/SpecSpec.js +37 -37
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +46 -7
- data/lib/jasmine-core/spec/core/SpySpec.js +11 -11
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +25 -13
- data/lib/jasmine-core/spec/core/SuiteSpec.js +25 -25
- data/lib/jasmine-core/spec/core/TimerSpec.js +2 -2
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +26 -26
- data/lib/jasmine-core/spec/core/UtilSpec.js +12 -12
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +8 -8
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +7 -7
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +6 -6
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +11 -11
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +4 -4
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +2 -2
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +195 -76
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +20 -21
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +164 -114
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +4 -4
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -3
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -4
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +2 -2
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +11 -11
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +22 -17
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +11 -10
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +7 -6
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +24 -24
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +9 -8
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +3 -3
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +5 -5
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +95 -59
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +3 -3
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +1 -1
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +4 -4
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +5 -5
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +4 -4
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +2 -2
- data/lib/jasmine-core/spec/performance/large_object_test.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +5 -3
- data/lib/jasmine-core/spec/node_suite.js +0 -195
@@ -1,10 +1,11 @@
|
|
1
1
|
describe("toHaveBeenCalledWith", function() {
|
2
|
+
|
2
3
|
it("passes when the actual was called with matching parameters", function() {
|
3
4
|
var util = {
|
4
5
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
5
6
|
},
|
6
|
-
matcher =
|
7
|
-
calledSpy =
|
7
|
+
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(util),
|
8
|
+
calledSpy = jasmineUnderTest.createSpy('called-spy'),
|
8
9
|
result;
|
9
10
|
|
10
11
|
calledSpy('a', 'b');
|
@@ -19,8 +20,8 @@ describe("toHaveBeenCalledWith", function() {
|
|
19
20
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
|
20
21
|
},
|
21
22
|
customEqualityTesters = [function() { return true; }],
|
22
|
-
matcher =
|
23
|
-
calledSpy =
|
23
|
+
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(util, customEqualityTesters),
|
24
|
+
calledSpy = jasmineUnderTest.createSpy('called-spy');
|
24
25
|
|
25
26
|
calledSpy('a', 'b');
|
26
27
|
matcher.compare(calledSpy, 'a', 'b');
|
@@ -32,8 +33,8 @@ describe("toHaveBeenCalledWith", function() {
|
|
32
33
|
var util = {
|
33
34
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(false)
|
34
35
|
},
|
35
|
-
matcher =
|
36
|
-
uncalledSpy =
|
36
|
+
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(util),
|
37
|
+
uncalledSpy = jasmineUnderTest.createSpy('uncalled spy'),
|
37
38
|
result;
|
38
39
|
|
39
40
|
result = matcher.compare(uncalledSpy);
|
@@ -45,8 +46,8 @@ describe("toHaveBeenCalledWith", function() {
|
|
45
46
|
var util = {
|
46
47
|
contains: jasmine.createSpy('delegated-contains').and.returnValue(false)
|
47
48
|
},
|
48
|
-
matcher =
|
49
|
-
calledSpy =
|
49
|
+
matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(util),
|
50
|
+
calledSpy = jasmineUnderTest.createSpy('called spy'),
|
50
51
|
result;
|
51
52
|
|
52
53
|
calledSpy('a');
|
@@ -58,9 +59,9 @@ describe("toHaveBeenCalledWith", function() {
|
|
58
59
|
});
|
59
60
|
|
60
61
|
it("throws an exception when the actual is not a spy", function() {
|
61
|
-
var matcher =
|
62
|
+
var matcher = jasmineUnderTest.matchers.toHaveBeenCalledWith(),
|
62
63
|
fn = function() {};
|
63
64
|
|
64
|
-
expect(function() { matcher.compare(fn) }).
|
65
|
+
expect(function() { matcher.compare(fn) }).toThrowError(/Expected a spy, but got Function./);
|
65
66
|
});
|
66
67
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
describe("toMatch", function() {
|
2
|
+
|
2
3
|
it("passes when RegExps are equivalent", function() {
|
3
|
-
var matcher =
|
4
|
+
var matcher = jasmineUnderTest.matchers.toMatch(),
|
4
5
|
result;
|
5
6
|
|
6
7
|
result = matcher.compare(/foo/, /foo/);
|
@@ -8,7 +9,7 @@ describe("toMatch", function() {
|
|
8
9
|
});
|
9
10
|
|
10
11
|
it("fails when RegExps are not equivalent", function() {
|
11
|
-
var matcher =
|
12
|
+
var matcher = jasmineUnderTest.matchers.toMatch(),
|
12
13
|
result;
|
13
14
|
|
14
15
|
result = matcher.compare(/bar/, /foo/);
|
@@ -16,7 +17,7 @@ describe("toMatch", function() {
|
|
16
17
|
});
|
17
18
|
|
18
19
|
it("passes when the actual matches the expected string as a pattern", function() {
|
19
|
-
var matcher =
|
20
|
+
var matcher = jasmineUnderTest.matchers.toMatch(),
|
20
21
|
result;
|
21
22
|
|
22
23
|
result = matcher.compare('foosball', 'foo');
|
@@ -24,7 +25,7 @@ describe("toMatch", function() {
|
|
24
25
|
});
|
25
26
|
|
26
27
|
it("fails when the actual matches the expected string as a pattern", function() {
|
27
|
-
var matcher =
|
28
|
+
var matcher = jasmineUnderTest.matchers.toMatch(),
|
28
29
|
result;
|
29
30
|
|
30
31
|
result = matcher.compare('bar', 'foo');
|
@@ -32,11 +33,11 @@ describe("toMatch", function() {
|
|
32
33
|
});
|
33
34
|
|
34
35
|
it("throws an Error when the expected is not a String or RegExp", function() {
|
35
|
-
var matcher =
|
36
|
+
var matcher = jasmineUnderTest.matchers.toMatch();
|
36
37
|
|
37
38
|
expect(function() {
|
38
39
|
matcher.compare('foo', { bar: 'baz' });
|
39
|
-
}).toThrowError(
|
40
|
+
}).toThrowError(/Expected is not a String or a RegExp/);
|
40
41
|
});
|
41
42
|
});
|
42
43
|
|
@@ -1,47 +1,47 @@
|
|
1
1
|
describe("toThrowError", function() {
|
2
2
|
it("throws an error when the actual is not a function", function() {
|
3
|
-
var matcher =
|
3
|
+
var matcher = jasmineUnderTest.matchers.toThrowError();
|
4
4
|
|
5
5
|
expect(function() {
|
6
6
|
matcher.compare({});
|
7
|
-
}).toThrowError(
|
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() {
|
11
|
-
var matcher =
|
11
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
12
12
|
fn = function() {
|
13
13
|
throw new Error("foo");
|
14
14
|
};
|
15
15
|
|
16
16
|
expect(function() {
|
17
17
|
matcher.compare(fn, 1);
|
18
|
-
}).toThrowError(
|
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() {
|
22
|
-
var matcher =
|
22
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
23
23
|
fn = function() {
|
24
24
|
throw new Error("foo");
|
25
25
|
};
|
26
26
|
|
27
27
|
expect(function() {
|
28
28
|
matcher.compare(fn, void 0, "foo");
|
29
|
-
}).toThrowError(
|
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() {
|
33
|
-
var matcher =
|
33
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
34
34
|
fn = function() {
|
35
35
|
throw new Error("foo");
|
36
36
|
};
|
37
37
|
|
38
38
|
expect(function() {
|
39
39
|
matcher.compare(fn, Error, 1);
|
40
|
-
}).toThrowError(
|
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() {
|
44
|
-
var matcher =
|
44
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
45
45
|
fn = function() {
|
46
46
|
return true;
|
47
47
|
},
|
@@ -54,7 +54,7 @@ describe("toThrowError", function() {
|
|
54
54
|
});
|
55
55
|
|
56
56
|
it("fails if thrown is not an instanceof Error", function() {
|
57
|
-
var matcher =
|
57
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
58
58
|
fn = function() {
|
59
59
|
throw 4;
|
60
60
|
},
|
@@ -66,7 +66,7 @@ describe("toThrowError", function() {
|
|
66
66
|
});
|
67
67
|
|
68
68
|
it("fails with the correct message if thrown is a falsy value", function() {
|
69
|
-
var matcher =
|
69
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
70
70
|
fn = function() {
|
71
71
|
throw undefined;
|
72
72
|
},
|
@@ -78,7 +78,7 @@ describe("toThrowError", function() {
|
|
78
78
|
});
|
79
79
|
|
80
80
|
it("passes if thrown is a type of Error, but there is no expected error", function() {
|
81
|
-
var matcher =
|
81
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
82
82
|
fn = function() {
|
83
83
|
throw new TypeError();
|
84
84
|
},
|
@@ -91,7 +91,7 @@ describe("toThrowError", function() {
|
|
91
91
|
});
|
92
92
|
|
93
93
|
it("passes if thrown is an Error and the expected is the same message", function() {
|
94
|
-
var matcher =
|
94
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
95
95
|
fn = function() {
|
96
96
|
throw new Error("foo");
|
97
97
|
},
|
@@ -104,7 +104,7 @@ describe("toThrowError", function() {
|
|
104
104
|
});
|
105
105
|
|
106
106
|
it("fails if thrown is an Error and the expected is not the same message", function() {
|
107
|
-
var matcher =
|
107
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
108
108
|
fn = function() {
|
109
109
|
throw new Error("foo");
|
110
110
|
},
|
@@ -117,7 +117,7 @@ describe("toThrowError", function() {
|
|
117
117
|
});
|
118
118
|
|
119
119
|
it("passes if thrown is an Error and the expected is a RegExp that matches the message", function() {
|
120
|
-
var matcher =
|
120
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
121
121
|
fn = function() {
|
122
122
|
throw new Error("a long message");
|
123
123
|
},
|
@@ -130,7 +130,7 @@ describe("toThrowError", function() {
|
|
130
130
|
});
|
131
131
|
|
132
132
|
it("fails if thrown is an Error and the expected is a RegExp that does not match the message", function() {
|
133
|
-
var matcher =
|
133
|
+
var matcher = jasmineUnderTest.matchers.toThrowError(),
|
134
134
|
fn = function() {
|
135
135
|
throw new Error("a long message");
|
136
136
|
},
|
@@ -146,7 +146,7 @@ describe("toThrowError", function() {
|
|
146
146
|
var util = {
|
147
147
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
148
148
|
},
|
149
|
-
matcher =
|
149
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
150
150
|
fn = function() {
|
151
151
|
throw new Error();
|
152
152
|
},
|
@@ -162,7 +162,7 @@ describe("toThrowError", function() {
|
|
162
162
|
var util = {
|
163
163
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
164
164
|
},
|
165
|
-
matcher =
|
165
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
166
166
|
CustomError = function CustomError(arg) { arg.x },
|
167
167
|
fn = function() {
|
168
168
|
throw new CustomError({ x: 1 });
|
@@ -181,7 +181,7 @@ describe("toThrowError", function() {
|
|
181
181
|
var util = {
|
182
182
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
183
183
|
},
|
184
|
-
matcher =
|
184
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
185
185
|
fn = function() {
|
186
186
|
throw new Error();
|
187
187
|
},
|
@@ -197,7 +197,7 @@ describe("toThrowError", function() {
|
|
197
197
|
var util = {
|
198
198
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
199
199
|
},
|
200
|
-
matcher =
|
200
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
201
201
|
fn = function() {
|
202
202
|
throw new TypeError("foo");
|
203
203
|
},
|
@@ -213,7 +213,7 @@ describe("toThrowError", function() {
|
|
213
213
|
var util = {
|
214
214
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
215
215
|
},
|
216
|
-
matcher =
|
216
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
217
217
|
CustomError = function CustomError(arg) { this.message = arg.message },
|
218
218
|
fn = function() {
|
219
219
|
throw new CustomError({message: "foo"});
|
@@ -232,7 +232,7 @@ describe("toThrowError", function() {
|
|
232
232
|
var util = {
|
233
233
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
234
234
|
},
|
235
|
-
matcher =
|
235
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
236
236
|
fn = function() {
|
237
237
|
throw new TypeError("foo");
|
238
238
|
},
|
@@ -248,7 +248,7 @@ describe("toThrowError", function() {
|
|
248
248
|
var util = {
|
249
249
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
250
250
|
},
|
251
|
-
matcher =
|
251
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
252
252
|
fn = function() {
|
253
253
|
throw new TypeError("foo");
|
254
254
|
},
|
@@ -264,7 +264,7 @@ describe("toThrowError", function() {
|
|
264
264
|
var util = {
|
265
265
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
266
266
|
},
|
267
|
-
matcher =
|
267
|
+
matcher = jasmineUnderTest.matchers.toThrowError(),
|
268
268
|
fn = function() {
|
269
269
|
throw new TypeError("foo");
|
270
270
|
},
|
@@ -1,15 +1,16 @@
|
|
1
1
|
describe("toThrow", function() {
|
2
|
+
|
2
3
|
it("throws an error when the actual is not a function", function() {
|
3
|
-
var matcher =
|
4
|
+
var matcher = jasmineUnderTest.matchers.toThrow();
|
4
5
|
|
5
6
|
expect(function() {
|
6
7
|
matcher.compare({});
|
7
8
|
matcherComparator({});
|
8
|
-
}).toThrowError(
|
9
|
+
}).toThrowError(/Actual is not a Function/);
|
9
10
|
});
|
10
11
|
|
11
12
|
it("fails if actual does not throw", function() {
|
12
|
-
var matcher =
|
13
|
+
var matcher = jasmineUnderTest.matchers.toThrow(),
|
13
14
|
fn = function() {
|
14
15
|
return true;
|
15
16
|
},
|
@@ -25,7 +26,7 @@ describe("toThrow", function() {
|
|
25
26
|
var util = {
|
26
27
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
27
28
|
},
|
28
|
-
matcher =
|
29
|
+
matcher = jasmineUnderTest.matchers.toThrow(util),
|
29
30
|
fn = function() {
|
30
31
|
throw 5;
|
31
32
|
},
|
@@ -38,7 +39,7 @@ describe("toThrow", function() {
|
|
38
39
|
});
|
39
40
|
|
40
41
|
it("passes even if what is thrown is falsy", function() {
|
41
|
-
var matcher =
|
42
|
+
var matcher = jasmineUnderTest.matchers.toThrow(),
|
42
43
|
fn = function() {
|
43
44
|
throw undefined;
|
44
45
|
},
|
@@ -53,7 +54,7 @@ describe("toThrow", function() {
|
|
53
54
|
var util = {
|
54
55
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(true)
|
55
56
|
},
|
56
|
-
matcher =
|
57
|
+
matcher = jasmineUnderTest.matchers.toThrow(util),
|
57
58
|
fn = function() {
|
58
59
|
throw 5;
|
59
60
|
},
|
@@ -69,7 +70,7 @@ describe("toThrow", function() {
|
|
69
70
|
var util = {
|
70
71
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
71
72
|
},
|
72
|
-
matcher =
|
73
|
+
matcher = jasmineUnderTest.matchers.toThrow(util),
|
73
74
|
fn = function() {
|
74
75
|
throw 5;
|
75
76
|
},
|
@@ -85,7 +86,7 @@ describe("toThrow", function() {
|
|
85
86
|
var util = {
|
86
87
|
equals: jasmine.createSpy('delegated-equal').and.returnValue(false)
|
87
88
|
},
|
88
|
-
matcher =
|
89
|
+
matcher = jasmineUnderTest.matchers.toThrow(util),
|
89
90
|
fn = function() {
|
90
91
|
throw 5;
|
91
92
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
(function() {
|
2
2
|
// By the time onload is called, jasmineRequire will be redefined to point
|
3
3
|
// to the Jasmine source files (and not jasmine.js). So re-require
|
4
|
-
window.
|
5
|
-
jasmineRequire.html(
|
6
|
-
jasmineRequire.console(jasmineRequire,
|
4
|
+
window.jasmineUnderTest = jasmineRequire.core(jasmineRequire);
|
5
|
+
jasmineRequire.html(jasmineUnderTest);
|
6
|
+
jasmineRequire.console(jasmineRequire, jasmineUnderTest);
|
7
7
|
})();
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
var glob = require("glob");
|
6
6
|
|
7
|
-
var
|
7
|
+
var jasmineUnderTestRequire = require(path.join(__dirname, "../../src/core/requireCore.js"));
|
8
8
|
|
9
9
|
global.getJasmineRequireObj = function () {
|
10
|
-
return
|
10
|
+
return jasmineUnderTestRequire;
|
11
11
|
};
|
12
12
|
|
13
13
|
function extend(destination, source) {
|
@@ -25,9 +25,9 @@
|
|
25
25
|
});
|
26
26
|
}
|
27
27
|
|
28
|
-
extend(
|
28
|
+
extend(jasmineUnderTestRequire, require(path.join(__dirname,"../../src/console/requireConsole.js")));
|
29
29
|
getSourceFiles();
|
30
|
-
global.
|
30
|
+
global.jasmineUnderTest = jasmineUnderTestRequire.core(jasmineUnderTestRequire);
|
31
31
|
|
32
|
-
|
32
|
+
jasmineUnderTestRequire.console(jasmineUnderTestRequire, jasmineUnderTest);
|
33
33
|
})();
|
@@ -1,10 +1,9 @@
|
|
1
1
|
describe("New HtmlReporter", function() {
|
2
|
-
// TODO: Figure out why this isn't rendering...
|
3
2
|
it("builds the initial DOM elements, including the title banner", function() {
|
4
|
-
var env = new
|
3
|
+
var env = new jasmineUnderTest.Env(),
|
5
4
|
container = document.createElement("div"),
|
6
5
|
getContainer = function() { return container; },
|
7
|
-
reporter = new
|
6
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
8
7
|
env: env,
|
9
8
|
getContainer: getContainer,
|
10
9
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -29,14 +28,14 @@ describe("New HtmlReporter", function() {
|
|
29
28
|
|
30
29
|
var version = banner.querySelector(".jasmine-version"),
|
31
30
|
versionText = 'textContent' in version ? version.textContent : version.innerText;
|
32
|
-
expect(versionText).toEqual(
|
31
|
+
expect(versionText).toEqual(jasmineUnderTest.version);
|
33
32
|
});
|
34
33
|
|
35
34
|
it("builds a single reporter even if initialized multiple times", function() {
|
36
|
-
var env = new
|
35
|
+
var env = new jasmineUnderTest.Env(),
|
37
36
|
container = document.createElement("div"),
|
38
37
|
getContainer = function() { return container; },
|
39
|
-
reporter = new
|
38
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
40
39
|
env: env,
|
41
40
|
getContainer: getContainer,
|
42
41
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -52,7 +51,7 @@ describe("New HtmlReporter", function() {
|
|
52
51
|
it("starts the timer when jasmine begins", function() {
|
53
52
|
var env = new jasmine.Env(),
|
54
53
|
startTimerSpy = jasmine.createSpy("start-timer-spy"),
|
55
|
-
reporter = new
|
54
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
56
55
|
env: env,
|
57
56
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
58
57
|
timer: { start: startTimerSpy }
|
@@ -69,10 +68,10 @@ describe("New HtmlReporter", function() {
|
|
69
68
|
console = { error: function(){} };
|
70
69
|
}
|
71
70
|
|
72
|
-
var env = new
|
71
|
+
var env = new jasmineUnderTest.Env(),
|
73
72
|
container = document.createElement('div'),
|
74
73
|
getContainer = function() {return container;},
|
75
|
-
reporter = new
|
74
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
76
75
|
env: env,
|
77
76
|
getContainer: getContainer,
|
78
77
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -95,10 +94,10 @@ describe("New HtmlReporter", function() {
|
|
95
94
|
});
|
96
95
|
|
97
96
|
it("reports the status symbol of a disabled spec", function() {
|
98
|
-
var env = new
|
97
|
+
var env = new jasmineUnderTest.Env(),
|
99
98
|
container = document.createElement("div"),
|
100
99
|
getContainer = function() { return container; },
|
101
|
-
reporter = new
|
100
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
102
101
|
env: env,
|
103
102
|
getContainer: getContainer,
|
104
103
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -115,10 +114,10 @@ describe("New HtmlReporter", function() {
|
|
115
114
|
});
|
116
115
|
|
117
116
|
it("reports the status symbol of a pending spec", function() {
|
118
|
-
var env = new
|
117
|
+
var env = new jasmineUnderTest.Env(),
|
119
118
|
container = document.createElement("div"),
|
120
119
|
getContainer = function() { return container; },
|
121
|
-
reporter = new
|
120
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
122
121
|
env: env,
|
123
122
|
getContainer: getContainer,
|
124
123
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -134,10 +133,10 @@ describe("New HtmlReporter", function() {
|
|
134
133
|
});
|
135
134
|
|
136
135
|
it("reports the status symbol of a passing spec", function() {
|
137
|
-
var env = new
|
136
|
+
var env = new jasmineUnderTest.Env(),
|
138
137
|
container = document.createElement("div"),
|
139
138
|
getContainer = function() { return container; },
|
140
|
-
reporter = new
|
139
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
141
140
|
env: env,
|
142
141
|
getContainer: getContainer,
|
143
142
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -154,10 +153,10 @@ describe("New HtmlReporter", function() {
|
|
154
153
|
});
|
155
154
|
|
156
155
|
it("reports the status symbol of a failing spec", function() {
|
157
|
-
var env = new
|
156
|
+
var env = new jasmineUnderTest.Env(),
|
158
157
|
container = document.createElement("div"),
|
159
158
|
getContainer = function() { return container; },
|
160
|
-
reporter = new
|
159
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
161
160
|
env: env,
|
162
161
|
getContainer: getContainer,
|
163
162
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -181,10 +180,10 @@ describe("New HtmlReporter", function() {
|
|
181
180
|
|
182
181
|
describe("when there are suite failures", function () {
|
183
182
|
it("displays the exceptions in their own alert bars", function(){
|
184
|
-
var env = new
|
183
|
+
var env = new jasmineUnderTest.Env(),
|
185
184
|
container = document.createElement("div"),
|
186
185
|
getContainer = function() { return container; },
|
187
|
-
reporter = new
|
186
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
188
187
|
env: env,
|
189
188
|
getContainer: getContainer,
|
190
189
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -196,14 +195,16 @@ describe("New HtmlReporter", function() {
|
|
196
195
|
reporter.jasmineStarted({});
|
197
196
|
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My After All Exception' }] });
|
198
197
|
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My Other Exception' }] });
|
199
|
-
reporter.jasmineDone({});
|
198
|
+
reporter.jasmineDone({ failedExpectations: [{ message: 'Global After All Failure' }, { message: 'Other Global' }] });
|
200
199
|
|
201
200
|
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
202
201
|
|
203
|
-
expect(alertBars.length).toEqual(
|
202
|
+
expect(alertBars.length).toEqual(5);
|
204
203
|
expect(alertBars[1].innerHTML).toMatch(/My After All Exception/);
|
205
204
|
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-errored');
|
206
205
|
expect(alertBars[2].innerHTML).toMatch(/My Other Exception/);
|
206
|
+
expect(alertBars[3].innerHTML).toMatch(/Global After All Failure/);
|
207
|
+
expect(alertBars[4].innerHTML).toMatch(/Other Global/);
|
207
208
|
});
|
208
209
|
});
|
209
210
|
|
@@ -212,10 +213,10 @@ describe("New HtmlReporter", function() {
|
|
212
213
|
if (!window.console) {
|
213
214
|
window.console = { error: function(){} };
|
214
215
|
}
|
215
|
-
var env = new
|
216
|
+
var env = new jasmineUnderTest.Env(),
|
216
217
|
container = document.createElement('div'),
|
217
218
|
getContainer = function() {return container;},
|
218
|
-
reporter = new
|
219
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
219
220
|
env: env,
|
220
221
|
getContainer: getContainer,
|
221
222
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -247,11 +248,11 @@ describe("New HtmlReporter", function() {
|
|
247
248
|
});
|
248
249
|
|
249
250
|
it("reports the run time", function() {
|
250
|
-
var env = new
|
251
|
+
var env = new jasmineUnderTest.Env(),
|
251
252
|
container = document.createElement("div"),
|
252
253
|
timer = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
253
254
|
getContainer = function() { return container; },
|
254
|
-
reporter = new
|
255
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
255
256
|
env: env,
|
256
257
|
getContainer: getContainer,
|
257
258
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -271,10 +272,10 @@ describe("New HtmlReporter", function() {
|
|
271
272
|
});
|
272
273
|
|
273
274
|
it("reports the suite and spec names with status", function() {
|
274
|
-
var env = new
|
275
|
+
var env = new jasmineUnderTest.Env(),
|
275
276
|
container = document.createElement("div"),
|
276
277
|
getContainer = function() { return container; },
|
277
|
-
reporter = new
|
278
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
278
279
|
env: env,
|
279
280
|
getContainer: getContainer,
|
280
281
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -365,12 +366,12 @@ describe("New HtmlReporter", function() {
|
|
365
366
|
});
|
366
367
|
|
367
368
|
it("has an options menu", function() {
|
368
|
-
var env = new
|
369
|
+
var env = new jasmineUnderTest.Env(),
|
369
370
|
container = document.createElement("div"),
|
370
371
|
getContainer = function() {
|
371
372
|
return container;
|
372
373
|
},
|
373
|
-
reporter = new
|
374
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
374
375
|
env: env,
|
375
376
|
getContainer: getContainer,
|
376
377
|
createElement: function() {
|
@@ -400,12 +401,12 @@ describe("New HtmlReporter", function() {
|
|
400
401
|
|
401
402
|
describe("UI for raising/catching exceptions", function() {
|
402
403
|
it("should be unchecked if the env is catching", function() {
|
403
|
-
var env = new
|
404
|
+
var env = new jasmineUnderTest.Env(),
|
404
405
|
container = document.createElement("div"),
|
405
406
|
getContainer = function() {
|
406
407
|
return container;
|
407
408
|
},
|
408
|
-
reporter = new
|
409
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
409
410
|
env: env,
|
410
411
|
getContainer: getContainer,
|
411
412
|
createElement: function() {
|
@@ -424,12 +425,12 @@ describe("New HtmlReporter", function() {
|
|
424
425
|
});
|
425
426
|
|
426
427
|
it("should be checked if the env is not catching", function() {
|
427
|
-
var env = new
|
428
|
+
var env = new jasmineUnderTest.Env(),
|
428
429
|
container = document.createElement("div"),
|
429
430
|
getContainer = function() {
|
430
431
|
return container;
|
431
432
|
},
|
432
|
-
reporter = new
|
433
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
433
434
|
env: env,
|
434
435
|
getContainer: getContainer,
|
435
436
|
createElement: function() {
|
@@ -449,13 +450,13 @@ describe("New HtmlReporter", function() {
|
|
449
450
|
});
|
450
451
|
|
451
452
|
it("should affect the query param for catching exceptions", function() {
|
452
|
-
var env = new
|
453
|
+
var env = new jasmineUnderTest.Env(),
|
453
454
|
container = document.createElement("div"),
|
454
455
|
exceptionsClickHandler = jasmine.createSpy("raise exceptions checked"),
|
455
456
|
getContainer = function() {
|
456
457
|
return container;
|
457
458
|
},
|
458
|
-
reporter = new
|
459
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
459
460
|
env: env,
|
460
461
|
getContainer: getContainer,
|
461
462
|
onRaiseExceptionsClick: exceptionsClickHandler,
|
@@ -478,12 +479,12 @@ describe("New HtmlReporter", function() {
|
|
478
479
|
|
479
480
|
describe("UI for throwing errors on expectation failures", function() {
|
480
481
|
it("should be unchecked if not throwing", function() {
|
481
|
-
var env = new
|
482
|
+
var env = new jasmineUnderTest.Env(),
|
482
483
|
container = document.createElement("div"),
|
483
484
|
getContainer = function() {
|
484
485
|
return container;
|
485
486
|
},
|
486
|
-
reporter = new
|
487
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
487
488
|
env: env,
|
488
489
|
getContainer: getContainer,
|
489
490
|
createElement: function() {
|
@@ -502,12 +503,12 @@ describe("New HtmlReporter", function() {
|
|
502
503
|
});
|
503
504
|
|
504
505
|
it("should be checked if throwing", function() {
|
505
|
-
var env = new
|
506
|
+
var env = new jasmineUnderTest.Env(),
|
506
507
|
container = document.createElement("div"),
|
507
508
|
getContainer = function() {
|
508
509
|
return container;
|
509
510
|
},
|
510
|
-
reporter = new
|
511
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
511
512
|
env: env,
|
512
513
|
getContainer: getContainer,
|
513
514
|
createElement: function() {
|
@@ -528,13 +529,13 @@ describe("New HtmlReporter", function() {
|
|
528
529
|
});
|
529
530
|
|
530
531
|
it("should affect the query param for throw expectation failures", function() {
|
531
|
-
var env = new
|
532
|
+
var env = new jasmineUnderTest.Env(),
|
532
533
|
container = document.createElement("div"),
|
533
534
|
throwingExceptionHandler = jasmine.createSpy('throwingExceptions'),
|
534
535
|
getContainer = function() {
|
535
536
|
return container;
|
536
537
|
},
|
537
|
-
reporter = new
|
538
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
538
539
|
env: env,
|
539
540
|
getContainer: getContainer,
|
540
541
|
onThrowExpectationsClick: throwingExceptionHandler,
|
@@ -558,12 +559,12 @@ describe("New HtmlReporter", function() {
|
|
558
559
|
|
559
560
|
describe("UI for running tests in random order", function() {
|
560
561
|
it("should be unchecked if not randomizing", function() {
|
561
|
-
var env = new
|
562
|
+
var env = new jasmineUnderTest.Env(),
|
562
563
|
container = document.createElement("div"),
|
563
564
|
getContainer = function() {
|
564
565
|
return container;
|
565
566
|
},
|
566
|
-
reporter = new
|
567
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
567
568
|
env: env,
|
568
569
|
getContainer: getContainer,
|
569
570
|
createElement: function() {
|
@@ -582,12 +583,12 @@ describe("New HtmlReporter", function() {
|
|
582
583
|
});
|
583
584
|
|
584
585
|
it("should be checked if randomizing", function() {
|
585
|
-
var env = new
|
586
|
+
var env = new jasmineUnderTest.Env(),
|
586
587
|
container = document.createElement("div"),
|
587
588
|
getContainer = function() {
|
588
589
|
return container;
|
589
590
|
},
|
590
|
-
reporter = new
|
591
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
591
592
|
env: env,
|
592
593
|
getContainer: getContainer,
|
593
594
|
createElement: function() {
|
@@ -607,13 +608,13 @@ describe("New HtmlReporter", function() {
|
|
607
608
|
});
|
608
609
|
|
609
610
|
it("should affect the query param for random tests", function() {
|
610
|
-
var env = new
|
611
|
+
var env = new jasmineUnderTest.Env(),
|
611
612
|
container = document.createElement("div"),
|
612
613
|
randomHandler = jasmine.createSpy('randomHandler'),
|
613
614
|
getContainer = function() {
|
614
615
|
return container;
|
615
616
|
},
|
616
|
-
reporter = new
|
617
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
617
618
|
env: env,
|
618
619
|
getContainer: getContainer,
|
619
620
|
onRandomClick: randomHandler,
|
@@ -635,12 +636,12 @@ describe("New HtmlReporter", function() {
|
|
635
636
|
});
|
636
637
|
|
637
638
|
it("should show the seed bar if randomizing", function() {
|
638
|
-
var env = new
|
639
|
+
var env = new jasmineUnderTest.Env(),
|
639
640
|
container = document.createElement("div"),
|
640
641
|
getContainer = function() {
|
641
642
|
return container;
|
642
643
|
},
|
643
|
-
reporter = new
|
644
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
644
645
|
env: env,
|
645
646
|
getContainer: getContainer,
|
646
647
|
createElement: function() {
|
@@ -667,12 +668,12 @@ describe("New HtmlReporter", function() {
|
|
667
668
|
});
|
668
669
|
|
669
670
|
it("should not show the current seed bar if not randomizing", function() {
|
670
|
-
var env = new
|
671
|
+
var env = new jasmineUnderTest.Env(),
|
671
672
|
container = document.createElement("div"),
|
672
673
|
getContainer = function() {
|
673
674
|
return container;
|
674
675
|
},
|
675
|
-
reporter = new
|
676
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
676
677
|
env: env,
|
677
678
|
getContainer: getContainer,
|
678
679
|
createElement: function() {
|
@@ -690,14 +691,49 @@ describe("New HtmlReporter", function() {
|
|
690
691
|
expect(seedBar).toBeNull();
|
691
692
|
});
|
692
693
|
|
694
|
+
it("should include the random query param in the jasmine-skipped link when randomizing", function(){
|
695
|
+
var env = new jasmineUnderTest.Env(),
|
696
|
+
container = document.createElement("div"),
|
697
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
698
|
+
env: env,
|
699
|
+
getContainer: function() { return container; },
|
700
|
+
createElement: function() { return document.createElement.apply(document, arguments); },
|
701
|
+
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
702
|
+
});
|
703
|
+
|
704
|
+
reporter.initialize();
|
705
|
+
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
706
|
+
reporter.jasmineDone({ order: { random: true } });
|
707
|
+
|
708
|
+
var skippedLink = container.querySelector(".jasmine-skipped a");
|
709
|
+
expect(skippedLink.getAttribute('href')).toEqual('?random=true');
|
710
|
+
});
|
711
|
+
|
712
|
+
it("should not include the random query param in the jasmine-skipped link when not randomizing", function(){
|
713
|
+
var env = new jasmineUnderTest.Env(),
|
714
|
+
container = document.createElement("div"),
|
715
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
716
|
+
env: env,
|
717
|
+
getContainer: function() { return container; },
|
718
|
+
createElement: function() { return document.createElement.apply(document, arguments); },
|
719
|
+
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
|
720
|
+
});
|
721
|
+
|
722
|
+
reporter.initialize();
|
723
|
+
reporter.jasmineStarted({ totalSpecsDefined: 1 });
|
724
|
+
reporter.jasmineDone();
|
725
|
+
|
726
|
+
var skippedLink = container.querySelector(".jasmine-skipped a");
|
727
|
+
expect(skippedLink.getAttribute('href')).toEqual('?');
|
728
|
+
});
|
693
729
|
});
|
694
730
|
|
695
731
|
it("shows a message if no specs are run", function(){
|
696
732
|
var env, container, reporter;
|
697
|
-
env = new
|
733
|
+
env = new jasmineUnderTest.Env();
|
698
734
|
container = document.createElement("div");
|
699
735
|
var getContainer = function() { return container; },
|
700
|
-
reporter = new
|
736
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
701
737
|
env: env,
|
702
738
|
getContainer: getContainer,
|
703
739
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -716,10 +752,10 @@ describe("New HtmlReporter", function() {
|
|
716
752
|
describe("and all specs pass", function() {
|
717
753
|
var env, container, reporter;
|
718
754
|
beforeEach(function() {
|
719
|
-
env = new
|
755
|
+
env = new jasmineUnderTest.Env();
|
720
756
|
container = document.createElement("div");
|
721
757
|
var getContainer = function() { return container; },
|
722
|
-
reporter = new
|
758
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
723
759
|
env: env,
|
724
760
|
getContainer: getContainer,
|
725
761
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -771,10 +807,10 @@ describe("New HtmlReporter", function() {
|
|
771
807
|
describe("and there are pending specs", function() {
|
772
808
|
var env, container, reporter;
|
773
809
|
beforeEach(function() {
|
774
|
-
env = new
|
810
|
+
env = new jasmineUnderTest.Env();
|
775
811
|
container = document.createElement("div");
|
776
812
|
var getContainer = function() { return container; };
|
777
|
-
reporter = new
|
813
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
778
814
|
env: env,
|
779
815
|
getContainer: getContainer,
|
780
816
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
@@ -820,10 +856,10 @@ describe("New HtmlReporter", function() {
|
|
820
856
|
var env, container, reporter;
|
821
857
|
|
822
858
|
beforeEach(function() {
|
823
|
-
env = new
|
859
|
+
env = new jasmineUnderTest.Env();
|
824
860
|
container = document.createElement("div");
|
825
861
|
var getContainer = function() { return container; }
|
826
|
-
reporter = new
|
862
|
+
reporter = new jasmineUnderTest.HtmlReporter({
|
827
863
|
env: env,
|
828
864
|
getContainer: getContainer,
|
829
865
|
createElement: function() { return document.createElement.apply(document, arguments); },
|