jasmine-core 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jasmine-core/boot/node_boot.js +1 -1
- data/lib/jasmine-core/jasmine-html.js +0 -35
- data/lib/jasmine-core/jasmine.css +0 -6
- data/lib/jasmine-core/jasmine.js +246 -36
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -88
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
- data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
- data/lib/jasmine-core/spec/core/ClockSpec.js +0 -710
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -286
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -120
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -46
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
- data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
- data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -332
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -670
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -140
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -407
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -364
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -177
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -202
- data/lib/jasmine-core/spec/core/StackTraceSpec.js +0 -166
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -123
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -794
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -105
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -91
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
- data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
- data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
- data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
- data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -200
- data/lib/jasmine-core/spec/core/integration/CustomSpyStrategiesSpec.js +0 -138
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2344
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -976
- data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
- data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -645
- data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
- data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -785
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
- data/lib/jasmine-core/spec/core/matchers/toThrowMatchingSpec.js +0 -73
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -15
- data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
- data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
- data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
- data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
- data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
- data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -6
- data/lib/jasmine-core/spec/helpers/integrationMatchers.js +0 -43
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -30
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -1261
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -27
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
- data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -39
- data/lib/jasmine-core/spec/html/matchers/toHaveClassSpec.js +0 -48
- data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
- data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
- data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,202 +0,0 @@
|
|
1
|
-
describe("SpyStrategy", function() {
|
2
|
-
|
3
|
-
it("defaults its name to unknown", function() {
|
4
|
-
var spyStrategy = new jasmineUnderTest.SpyStrategy();
|
5
|
-
|
6
|
-
expect(spyStrategy.identity).toEqual("unknown");
|
7
|
-
});
|
8
|
-
|
9
|
-
it("takes a name", function() {
|
10
|
-
var spyStrategy = new jasmineUnderTest.SpyStrategy({name: "foo"});
|
11
|
-
|
12
|
-
expect(spyStrategy.identity).toEqual("foo");
|
13
|
-
});
|
14
|
-
|
15
|
-
it("stubs an original function, if provided", function() {
|
16
|
-
var originalFn = jasmine.createSpy("original"),
|
17
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
18
|
-
|
19
|
-
spyStrategy.exec();
|
20
|
-
|
21
|
-
expect(originalFn).not.toHaveBeenCalled();
|
22
|
-
});
|
23
|
-
|
24
|
-
it("allows an original function to be called, passed through the params and returns it's value", function() {
|
25
|
-
var originalFn = jasmine.createSpy("original").and.returnValue(42),
|
26
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
27
|
-
returnValue;
|
28
|
-
|
29
|
-
spyStrategy.callThrough();
|
30
|
-
returnValue = spyStrategy.exec(null, ["foo"]);
|
31
|
-
|
32
|
-
expect(originalFn).toHaveBeenCalled();
|
33
|
-
expect(originalFn.calls.mostRecent().args).toEqual(["foo"]);
|
34
|
-
expect(returnValue).toEqual(42);
|
35
|
-
});
|
36
|
-
|
37
|
-
it("can return a specified value when executed", function() {
|
38
|
-
var originalFn = jasmine.createSpy("original"),
|
39
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
40
|
-
returnValue;
|
41
|
-
|
42
|
-
spyStrategy.returnValue(17);
|
43
|
-
returnValue = spyStrategy.exec();
|
44
|
-
|
45
|
-
expect(originalFn).not.toHaveBeenCalled();
|
46
|
-
expect(returnValue).toEqual(17);
|
47
|
-
});
|
48
|
-
|
49
|
-
it("can return specified values in order specified when executed", function() {
|
50
|
-
var originalFn = jasmine.createSpy("original"),
|
51
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
52
|
-
|
53
|
-
spyStrategy.returnValues('value1', 'value2', 'value3');
|
54
|
-
|
55
|
-
expect(spyStrategy.exec()).toEqual('value1');
|
56
|
-
expect(spyStrategy.exec()).toEqual('value2');
|
57
|
-
expect(spyStrategy.exec()).toBe('value3');
|
58
|
-
expect(spyStrategy.exec()).toBeUndefined();
|
59
|
-
expect(originalFn).not.toHaveBeenCalled();
|
60
|
-
});
|
61
|
-
|
62
|
-
it("allows an exception to be thrown when executed", function() {
|
63
|
-
var originalFn = jasmine.createSpy("original"),
|
64
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
65
|
-
|
66
|
-
spyStrategy.throwError(new TypeError("bar"));
|
67
|
-
|
68
|
-
expect(function() { spyStrategy.exec(); }).toThrowError(TypeError, "bar");
|
69
|
-
expect(originalFn).not.toHaveBeenCalled();
|
70
|
-
});
|
71
|
-
|
72
|
-
it("allows a non-Error to be thrown, wrapping it into an exception when executed", function() {
|
73
|
-
var originalFn = jasmine.createSpy("original"),
|
74
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
|
75
|
-
|
76
|
-
spyStrategy.throwError("bar");
|
77
|
-
|
78
|
-
expect(function() { spyStrategy.exec(); }).toThrowError(Error, "bar");
|
79
|
-
expect(originalFn).not.toHaveBeenCalled();
|
80
|
-
});
|
81
|
-
|
82
|
-
it("allows a fake function to be called instead", function() {
|
83
|
-
var originalFn = jasmine.createSpy("original"),
|
84
|
-
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
85
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
86
|
-
returnValue;
|
87
|
-
|
88
|
-
spyStrategy.callFake(fakeFn);
|
89
|
-
returnValue = spyStrategy.exec();
|
90
|
-
|
91
|
-
expect(originalFn).not.toHaveBeenCalled();
|
92
|
-
expect(returnValue).toEqual(67);
|
93
|
-
});
|
94
|
-
|
95
|
-
it("allows a fake async function to be called instead", function(done) {
|
96
|
-
jasmine.getEnv().requireAsyncAwait();
|
97
|
-
var originalFn = jasmine.createSpy("original"),
|
98
|
-
fakeFn = jasmine.createSpy("fake").and.callFake(eval("async () => { return 67; }")),
|
99
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
100
|
-
returnValue;
|
101
|
-
|
102
|
-
spyStrategy.callFake(fakeFn);
|
103
|
-
spyStrategy.exec().then(function (returnValue) {
|
104
|
-
expect(originalFn).not.toHaveBeenCalled();
|
105
|
-
expect(fakeFn).toHaveBeenCalled();
|
106
|
-
expect(returnValue).toEqual(67);
|
107
|
-
done();
|
108
|
-
}).catch(function (err) {
|
109
|
-
done.fail(err);
|
110
|
-
})
|
111
|
-
});
|
112
|
-
|
113
|
-
it("allows a custom strategy to be used", function() {
|
114
|
-
var plan = jasmine.createSpy('custom strategy')
|
115
|
-
.and.returnValue('custom strategy result'),
|
116
|
-
customStrategy = jasmine.createSpy('custom strategy')
|
117
|
-
.and.returnValue(plan),
|
118
|
-
originalFn = jasmine.createSpy('original'),
|
119
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({
|
120
|
-
fn: originalFn,
|
121
|
-
customStrategies: {
|
122
|
-
doSomething: customStrategy
|
123
|
-
}
|
124
|
-
});
|
125
|
-
|
126
|
-
spyStrategy.doSomething(1, 2, 3);
|
127
|
-
expect(customStrategy).toHaveBeenCalledWith(1, 2, 3);
|
128
|
-
expect(spyStrategy.exec(null, ['some', 'args']))
|
129
|
-
.toEqual('custom strategy result');
|
130
|
-
expect(plan).toHaveBeenCalledWith('some', 'args');
|
131
|
-
});
|
132
|
-
|
133
|
-
it("throws an error if a custom strategy doesn't return a function", function() {
|
134
|
-
var originalFn = jasmine.createSpy('original'),
|
135
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({
|
136
|
-
fn: originalFn,
|
137
|
-
customStrategies: {
|
138
|
-
doSomething: function() { return 'not a function' }
|
139
|
-
}
|
140
|
-
});
|
141
|
-
|
142
|
-
expect(function() { spyStrategy.doSomething(1, 2, 3) }).toThrowError('Spy strategy must return a function');
|
143
|
-
});
|
144
|
-
|
145
|
-
it("does not allow custom strategies to overwrite existing methods", function() {
|
146
|
-
var spyStrategy = new jasmineUnderTest.SpyStrategy({
|
147
|
-
fn: function() {},
|
148
|
-
customStrategies: {
|
149
|
-
exec: function() {}
|
150
|
-
}
|
151
|
-
});
|
152
|
-
|
153
|
-
expect(spyStrategy.exec).toBe(jasmineUnderTest.SpyStrategy.prototype.exec);
|
154
|
-
});
|
155
|
-
|
156
|
-
it('throws an error when a non-function is passed to callFake strategy', function() {
|
157
|
-
var originalFn = jasmine.createSpy('original'),
|
158
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
159
|
-
invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
|
160
|
-
|
161
|
-
spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
|
162
|
-
spyOn(jasmineUnderTest, 'isAsyncFunction_').and.returnValue(false);
|
163
|
-
|
164
|
-
expect(function () {
|
165
|
-
spyStrategy.callFake(function() {});
|
166
|
-
}).toThrowError(/^Argument passed to callFake should be a function, got/);
|
167
|
-
|
168
|
-
expect(function () {
|
169
|
-
spyStrategy.callFake(function() {});
|
170
|
-
}).toThrowError(/^Argument passed to callFake should be a function, got/);
|
171
|
-
});
|
172
|
-
|
173
|
-
it("allows a return to plan stubbing after another strategy", function() {
|
174
|
-
var originalFn = jasmine.createSpy("original"),
|
175
|
-
fakeFn = jasmine.createSpy("fake").and.returnValue(67),
|
176
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
|
177
|
-
returnValue;
|
178
|
-
|
179
|
-
spyStrategy.callFake(fakeFn);
|
180
|
-
returnValue = spyStrategy.exec();
|
181
|
-
|
182
|
-
expect(originalFn).not.toHaveBeenCalled();
|
183
|
-
expect(returnValue).toEqual(67);
|
184
|
-
|
185
|
-
spyStrategy.stub();
|
186
|
-
returnValue = spyStrategy.exec();
|
187
|
-
|
188
|
-
expect(returnValue).toEqual(void 0);
|
189
|
-
});
|
190
|
-
|
191
|
-
it("returns the spy after changing the strategy", function(){
|
192
|
-
var spy = {},
|
193
|
-
spyFn = jasmine.createSpy('spyFn').and.returnValue(spy),
|
194
|
-
spyStrategy = new jasmineUnderTest.SpyStrategy({getSpy: spyFn});
|
195
|
-
|
196
|
-
expect(spyStrategy.callThrough()).toBe(spy);
|
197
|
-
expect(spyStrategy.returnValue()).toBe(spy);
|
198
|
-
expect(spyStrategy.throwError()).toBe(spy);
|
199
|
-
expect(spyStrategy.callFake(function() {})).toBe(spy);
|
200
|
-
expect(spyStrategy.stub()).toBe(spy);
|
201
|
-
});
|
202
|
-
});
|
@@ -1,166 +0,0 @@
|
|
1
|
-
describe("StackTrace", function() {
|
2
|
-
it("understands Chrome/IE/Edge style traces", function() {
|
3
|
-
var raw =
|
4
|
-
'Error: nope\n' +
|
5
|
-
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
6
|
-
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
7
|
-
|
8
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
9
|
-
|
10
|
-
expect(result.message).toEqual('Error: nope');
|
11
|
-
expect(result.style).toEqual('v8');
|
12
|
-
expect(result.frames).toEqual([
|
13
|
-
{
|
14
|
-
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
15
|
-
func: 'UserContext.<anonymous>',
|
16
|
-
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
17
|
-
line: 115
|
18
|
-
},
|
19
|
-
{
|
20
|
-
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
21
|
-
func: 'QueueRunner.run',
|
22
|
-
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
23
|
-
line: 4320
|
24
|
-
}
|
25
|
-
]);
|
26
|
-
});
|
27
|
-
|
28
|
-
it("understands Node style traces", function() {
|
29
|
-
var raw = 'Error\n' +
|
30
|
-
' at /somewhere/jasmine/lib/jasmine-core/jasmine.js:4255:9\n' +
|
31
|
-
' at QueueRunner.complete [as onComplete] (/somewhere/jasmine/lib/jasmine-core/jasmine.js:579:9)\n' +
|
32
|
-
' at Immediate.<anonymous> (/somewhere/jasmine/lib/jasmine-core/jasmine.js:4314:12)\n' +
|
33
|
-
' at runCallback (timers.js:672:20)';
|
34
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
35
|
-
|
36
|
-
expect(result.message).toEqual('Error');
|
37
|
-
expect(result.style).toEqual('v8');
|
38
|
-
expect(result.frames).toEqual([
|
39
|
-
{
|
40
|
-
raw: ' at /somewhere/jasmine/lib/jasmine-core/jasmine.js:4255:9',
|
41
|
-
func: undefined,
|
42
|
-
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
43
|
-
line: 4255
|
44
|
-
},
|
45
|
-
{
|
46
|
-
raw: ' at QueueRunner.complete [as onComplete] (/somewhere/jasmine/lib/jasmine-core/jasmine.js:579:9)',
|
47
|
-
func: 'QueueRunner.complete [as onComplete]',
|
48
|
-
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
49
|
-
line: 579
|
50
|
-
},
|
51
|
-
{
|
52
|
-
raw: ' at Immediate.<anonymous> (/somewhere/jasmine/lib/jasmine-core/jasmine.js:4314:12)',
|
53
|
-
func: 'Immediate.<anonymous>',
|
54
|
-
file: '/somewhere/jasmine/lib/jasmine-core/jasmine.js',
|
55
|
-
line: 4314
|
56
|
-
},
|
57
|
-
{
|
58
|
-
raw: ' at runCallback (timers.js:672:20)',
|
59
|
-
func: 'runCallback',
|
60
|
-
file: 'timers.js',
|
61
|
-
line: 672
|
62
|
-
}
|
63
|
-
]);
|
64
|
-
});
|
65
|
-
|
66
|
-
it("understands Safari/Firefox/Phantom-OS X style traces", function() {
|
67
|
-
var raw =
|
68
|
-
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
|
69
|
-
'run@http://localhost:8888/__jasmine__/jasmine.js:4320:27';
|
70
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
71
|
-
|
72
|
-
expect(result.message).toBeFalsy();
|
73
|
-
expect(result.style).toEqual('webkit');
|
74
|
-
expect(result.frames).toEqual([
|
75
|
-
{
|
76
|
-
raw: 'http://localhost:8888/__spec__/core/UtilSpec.js:115:28',
|
77
|
-
func: undefined,
|
78
|
-
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
79
|
-
line: 115
|
80
|
-
},
|
81
|
-
{
|
82
|
-
raw: 'run@http://localhost:8888/__jasmine__/jasmine.js:4320:27',
|
83
|
-
func: 'run',
|
84
|
-
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
85
|
-
line: 4320
|
86
|
-
}
|
87
|
-
]);
|
88
|
-
});
|
89
|
-
|
90
|
-
it("does not mistake gibberish for Safari/Firefox/Phantom-OS X style traces", function() {
|
91
|
-
var raw = 'randomcharsnotincludingwhitespace';
|
92
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
93
|
-
expect(result.style).toBeNull();
|
94
|
-
expect(result.frames).toEqual([
|
95
|
-
{ raw: raw }
|
96
|
-
]);
|
97
|
-
});
|
98
|
-
|
99
|
-
it("understands Phantom-Linux style traces", function() {
|
100
|
-
var raw =
|
101
|
-
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
102
|
-
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
103
|
-
|
104
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
105
|
-
|
106
|
-
expect(result.message).toBeFalsy();
|
107
|
-
expect(result.style).toEqual('v8');
|
108
|
-
expect(result.frames).toEqual([
|
109
|
-
{
|
110
|
-
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
111
|
-
func: 'UserContext.<anonymous>',
|
112
|
-
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
113
|
-
line: 115
|
114
|
-
},
|
115
|
-
{
|
116
|
-
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
117
|
-
func: 'QueueRunner.run',
|
118
|
-
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
119
|
-
line: 4320
|
120
|
-
}
|
121
|
-
]);
|
122
|
-
});
|
123
|
-
|
124
|
-
it("ignores blank lines", function() {
|
125
|
-
var raw =
|
126
|
-
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n';
|
127
|
-
|
128
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
129
|
-
|
130
|
-
expect(result.frames).toEqual([
|
131
|
-
{
|
132
|
-
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
133
|
-
func: 'UserContext.<anonymous>',
|
134
|
-
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
135
|
-
line: 115
|
136
|
-
}
|
137
|
-
]);
|
138
|
-
});
|
139
|
-
|
140
|
-
it("omits properties except 'raw' for frames that are not understood", function() {
|
141
|
-
var raw =
|
142
|
-
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
143
|
-
' but this is quite unexpected\n' +
|
144
|
-
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)';
|
145
|
-
|
146
|
-
var result = new jasmineUnderTest.StackTrace(raw);
|
147
|
-
expect(result.style).toEqual('v8');
|
148
|
-
expect(result.frames).toEqual([
|
149
|
-
{
|
150
|
-
raw: ' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)',
|
151
|
-
func: 'UserContext.<anonymous>',
|
152
|
-
file: 'http://localhost:8888/__spec__/core/UtilSpec.js',
|
153
|
-
line: 115
|
154
|
-
},
|
155
|
-
{
|
156
|
-
raw: ' but this is quite unexpected'
|
157
|
-
},
|
158
|
-
{
|
159
|
-
raw: ' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)',
|
160
|
-
func: 'QueueRunner.run',
|
161
|
-
file: 'http://localhost:8888/__jasmine__/jasmine.js',
|
162
|
-
line: 4320
|
163
|
-
}
|
164
|
-
]);
|
165
|
-
});
|
166
|
-
});
|
@@ -1,123 +0,0 @@
|
|
1
|
-
describe("Suite", function() {
|
2
|
-
|
3
|
-
it("keeps its id", function() {
|
4
|
-
var env = new jasmineUnderTest.Env(),
|
5
|
-
suite = new jasmineUnderTest.Suite({
|
6
|
-
env: env,
|
7
|
-
id: 456,
|
8
|
-
description: "I am a suite"
|
9
|
-
});
|
10
|
-
|
11
|
-
expect(suite.id).toEqual(456);
|
12
|
-
});
|
13
|
-
|
14
|
-
it("returns blank full name for top level suite", function() {
|
15
|
-
var env = new jasmineUnderTest.Env(),
|
16
|
-
suite = new jasmineUnderTest.Suite({
|
17
|
-
env: env,
|
18
|
-
description: "I am a suite"
|
19
|
-
});
|
20
|
-
|
21
|
-
expect(suite.getFullName()).toEqual("");
|
22
|
-
});
|
23
|
-
|
24
|
-
it("returns its full name when it has parent suites", function() {
|
25
|
-
var env = new jasmineUnderTest.Env(),
|
26
|
-
parentSuite = new jasmineUnderTest.Suite({
|
27
|
-
env: env,
|
28
|
-
description: "I am a parent suite",
|
29
|
-
parentSuite: jasmine.createSpy('pretend top level suite')
|
30
|
-
}),
|
31
|
-
suite = new jasmineUnderTest.Suite({
|
32
|
-
env: env,
|
33
|
-
description: "I am a suite",
|
34
|
-
parentSuite: parentSuite
|
35
|
-
});
|
36
|
-
|
37
|
-
expect(suite.getFullName()).toEqual("I am a parent suite I am a suite");
|
38
|
-
});
|
39
|
-
|
40
|
-
it("adds before functions in order of needed execution", function() {
|
41
|
-
var env = new jasmineUnderTest.Env(),
|
42
|
-
suite = new jasmineUnderTest.Suite({
|
43
|
-
env: env,
|
44
|
-
description: "I am a suite"
|
45
|
-
}),
|
46
|
-
outerBefore = jasmine.createSpy('outerBeforeEach'),
|
47
|
-
innerBefore = jasmine.createSpy('insideBeforeEach');
|
48
|
-
|
49
|
-
suite.beforeEach(outerBefore);
|
50
|
-
suite.beforeEach(innerBefore);
|
51
|
-
|
52
|
-
expect(suite.beforeFns).toEqual([innerBefore, outerBefore]);
|
53
|
-
});
|
54
|
-
|
55
|
-
it("adds after functions in order of needed execution", function() {
|
56
|
-
var env = new jasmineUnderTest.Env(),
|
57
|
-
suite = new jasmineUnderTest.Suite({
|
58
|
-
env: env,
|
59
|
-
description: "I am a suite"
|
60
|
-
}),
|
61
|
-
outerAfter = jasmine.createSpy('outerAfterEach'),
|
62
|
-
innerAfter = jasmine.createSpy('insideAfterEach');
|
63
|
-
|
64
|
-
suite.afterEach(outerAfter);
|
65
|
-
suite.afterEach(innerAfter);
|
66
|
-
|
67
|
-
expect(suite.afterFns).toEqual([innerAfter, outerAfter]);
|
68
|
-
});
|
69
|
-
|
70
|
-
it('has a status of failed if any expectations have failed', function() {
|
71
|
-
var suite = new jasmineUnderTest.Suite({
|
72
|
-
expectationResultFactory: function() { return 'hi'; }
|
73
|
-
});
|
74
|
-
|
75
|
-
suite.addExpectationResult(false);
|
76
|
-
expect(suite.status()).toBe('failed');
|
77
|
-
});
|
78
|
-
|
79
|
-
it("retrieves a result with updated status", function() {
|
80
|
-
var suite = new jasmineUnderTest.Suite({});
|
81
|
-
|
82
|
-
expect(suite.getResult().status).toBe('passed');
|
83
|
-
});
|
84
|
-
|
85
|
-
it("retrieves a result with pending status", function() {
|
86
|
-
var suite = new jasmineUnderTest.Suite({});
|
87
|
-
suite.pend();
|
88
|
-
|
89
|
-
expect(suite.getResult().status).toBe('pending');
|
90
|
-
});
|
91
|
-
|
92
|
-
it("throws an ExpectationFailed when receiving a failed expectation when throwOnExpectationFailure is set", function() {
|
93
|
-
var suite = new jasmineUnderTest.Suite({
|
94
|
-
expectationResultFactory: function(data) { return data; },
|
95
|
-
throwOnExpectationFailure: true
|
96
|
-
});
|
97
|
-
|
98
|
-
expect(function() {
|
99
|
-
suite.addExpectationResult(false, 'failed');
|
100
|
-
}).toThrowError(jasmineUnderTest.errors.ExpectationFailed);
|
101
|
-
|
102
|
-
expect(suite.status()).toBe('failed');
|
103
|
-
expect(suite.result.failedExpectations).toEqual(['failed']);
|
104
|
-
});
|
105
|
-
|
106
|
-
it("does not add an additional failure when an expectation fails", function(){
|
107
|
-
var suite = new jasmineUnderTest.Suite({});
|
108
|
-
|
109
|
-
suite.onException(new jasmineUnderTest.errors.ExpectationFailed());
|
110
|
-
|
111
|
-
expect(suite.getResult().failedExpectations).toEqual([]);
|
112
|
-
});
|
113
|
-
|
114
|
-
describe('#sharedUserContext', function() {
|
115
|
-
beforeEach(function() {
|
116
|
-
this.suite = new jasmineUnderTest.Suite({});
|
117
|
-
});
|
118
|
-
|
119
|
-
it('returns a UserContext', function() {
|
120
|
-
expect(this.suite.sharedUserContext().constructor).toBe(jasmineUnderTest.UserContext);
|
121
|
-
});
|
122
|
-
});
|
123
|
-
});
|