jasmine-core 2.9.0 → 2.99.2
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/jasmine-html.js +24 -1
- data/lib/jasmine-core/jasmine.css +1 -0
- data/lib/jasmine-core/jasmine.js +50 -6
- data/lib/jasmine-core/version.rb +1 -1
- metadata +3 -84
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
- 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 -754
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
- data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
- 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 -337
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
- data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
- data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
- data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
- data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
- data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
- data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
- data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
- data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
- data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
- 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 -102
- 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 -199
- data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
- data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
- 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 -658
- 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 -804
- 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/toThrowSpec.js +0 -100
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
- 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 -7
- data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
- 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 -15
- 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 -34
- 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,130 +0,0 @@
|
|
1
|
-
describe("CallTracker", function() {
|
2
|
-
it("tracks that it was called when executed", function() {
|
3
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
4
|
-
|
5
|
-
expect(callTracker.any()).toBe(false);
|
6
|
-
|
7
|
-
callTracker.track();
|
8
|
-
|
9
|
-
expect(callTracker.any()).toBe(true);
|
10
|
-
});
|
11
|
-
|
12
|
-
it("tracks that number of times that it is executed", function() {
|
13
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
14
|
-
|
15
|
-
expect(callTracker.count()).toEqual(0);
|
16
|
-
|
17
|
-
callTracker.track();
|
18
|
-
|
19
|
-
expect(callTracker.count()).toEqual(1);
|
20
|
-
});
|
21
|
-
|
22
|
-
it("tracks the params from each execution", function() {
|
23
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
24
|
-
|
25
|
-
callTracker.track({object: void 0, args: []});
|
26
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
27
|
-
|
28
|
-
expect(callTracker.argsFor(0)).toEqual([]);
|
29
|
-
|
30
|
-
expect(callTracker.argsFor(1)).toEqual([0, "foo"]);
|
31
|
-
});
|
32
|
-
|
33
|
-
it("returns any empty array when there was no call", function() {
|
34
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
35
|
-
|
36
|
-
expect(callTracker.argsFor(0)).toEqual([]);
|
37
|
-
});
|
38
|
-
|
39
|
-
it("allows access for the arguments for all calls", function() {
|
40
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
41
|
-
|
42
|
-
callTracker.track({object: {}, args: []});
|
43
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
44
|
-
|
45
|
-
expect(callTracker.allArgs()).toEqual([[], [0, "foo"]]);
|
46
|
-
});
|
47
|
-
|
48
|
-
it("tracks the context and arguments for each call", function() {
|
49
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
50
|
-
|
51
|
-
callTracker.track({object: {}, args: []});
|
52
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
53
|
-
|
54
|
-
expect(callTracker.all()[0]).toEqual({object: {}, args: []});
|
55
|
-
|
56
|
-
expect(callTracker.all()[1]).toEqual({object: {}, args: [0, "foo"]});
|
57
|
-
});
|
58
|
-
|
59
|
-
it("simplifies access to the arguments for the last (most recent) call", function() {
|
60
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
61
|
-
|
62
|
-
callTracker.track();
|
63
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
64
|
-
|
65
|
-
expect(callTracker.mostRecent()).toEqual({
|
66
|
-
object: {},
|
67
|
-
args: [0, "foo"]
|
68
|
-
});
|
69
|
-
});
|
70
|
-
|
71
|
-
it("returns a useful falsy value when there isn't a last (most recent) call", function() {
|
72
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
73
|
-
|
74
|
-
expect(callTracker.mostRecent()).toBeFalsy();
|
75
|
-
});
|
76
|
-
|
77
|
-
it("simplifies access to the arguments for the first (oldest) call", function() {
|
78
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
79
|
-
|
80
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
81
|
-
|
82
|
-
expect(callTracker.first()).toEqual({object: {}, args: [0, "foo"]})
|
83
|
-
});
|
84
|
-
|
85
|
-
it("returns a useful falsy value when there isn't a first (oldest) call", function() {
|
86
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
87
|
-
|
88
|
-
expect(callTracker.first()).toBeFalsy();
|
89
|
-
});
|
90
|
-
|
91
|
-
|
92
|
-
it("allows the tracking to be reset", function() {
|
93
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
94
|
-
|
95
|
-
callTracker.track();
|
96
|
-
callTracker.track({object: {}, args: [0, "foo"]});
|
97
|
-
callTracker.reset();
|
98
|
-
|
99
|
-
expect(callTracker.any()).toBe(false);
|
100
|
-
expect(callTracker.count()).toEqual(0);
|
101
|
-
expect(callTracker.argsFor(0)).toEqual([]);
|
102
|
-
expect(callTracker.all()).toEqual([]);
|
103
|
-
expect(callTracker.mostRecent()).toBeFalsy();
|
104
|
-
});
|
105
|
-
|
106
|
-
it("allows object arguments to be shallow cloned", function() {
|
107
|
-
var callTracker = new jasmineUnderTest.CallTracker();
|
108
|
-
callTracker.saveArgumentsByValue();
|
109
|
-
|
110
|
-
var objectArg = {"foo": "bar"},
|
111
|
-
arrayArg = ["foo", "bar"];
|
112
|
-
|
113
|
-
callTracker.track({object: {}, args: [objectArg, arrayArg, false, undefined, null, NaN, "", 0, 1.0]});
|
114
|
-
|
115
|
-
expect(callTracker.mostRecent().args[0]).not.toBe(objectArg);
|
116
|
-
expect(callTracker.mostRecent().args[0]).toEqual(objectArg);
|
117
|
-
expect(callTracker.mostRecent().args[1]).not.toBe(arrayArg);
|
118
|
-
expect(callTracker.mostRecent().args[1]).toEqual(arrayArg);
|
119
|
-
});
|
120
|
-
|
121
|
-
it('saves primitive arguments by value', function() {
|
122
|
-
var callTracker = new jasmineUnderTest.CallTracker(),
|
123
|
-
args = [undefined, null, false, '', /\s/, 0, 1.2, NaN];
|
124
|
-
|
125
|
-
callTracker.saveArgumentsByValue();
|
126
|
-
callTracker.track({ object: {}, args: args });
|
127
|
-
|
128
|
-
expect(callTracker.mostRecent().args).toEqual(args);
|
129
|
-
});
|
130
|
-
});
|
@@ -1,137 +0,0 @@
|
|
1
|
-
describe("ClearStack", function() {
|
2
|
-
it("works in an integrationy way", function(done) {
|
3
|
-
var clearStack = jasmineUnderTest.getClearStack(jasmineUnderTest.getGlobal());
|
4
|
-
|
5
|
-
clearStack(function() {
|
6
|
-
done();
|
7
|
-
});
|
8
|
-
});
|
9
|
-
|
10
|
-
it("uses setImmediate when available", function() {
|
11
|
-
var setImmediate = jasmine.createSpy('setImmediate').and.callFake(function(fn) { fn() }),
|
12
|
-
global = { setImmediate: setImmediate },
|
13
|
-
clearStack = jasmineUnderTest.getClearStack(global),
|
14
|
-
called = false;
|
15
|
-
|
16
|
-
clearStack(function() {
|
17
|
-
called = true;
|
18
|
-
});
|
19
|
-
|
20
|
-
expect(called).toBe(true);
|
21
|
-
expect(setImmediate).toHaveBeenCalled();
|
22
|
-
});
|
23
|
-
|
24
|
-
it("uses setTimeout instead of setImmediate every 10 calls to make sure we release the CPU", function() {
|
25
|
-
var setImmediate = jasmine.createSpy('setImmediate'),
|
26
|
-
setTimeout = jasmine.createSpy('setTimeout'),
|
27
|
-
global = { setImmediate: setImmediate, setTimeout: setTimeout },
|
28
|
-
clearStack = jasmineUnderTest.getClearStack(global);
|
29
|
-
|
30
|
-
clearStack(function() { });
|
31
|
-
clearStack(function() { });
|
32
|
-
clearStack(function() { });
|
33
|
-
clearStack(function() { });
|
34
|
-
clearStack(function() { });
|
35
|
-
clearStack(function() { });
|
36
|
-
clearStack(function() { });
|
37
|
-
clearStack(function() { });
|
38
|
-
clearStack(function() { });
|
39
|
-
|
40
|
-
expect(setImmediate).toHaveBeenCalled();
|
41
|
-
expect(setTimeout).not.toHaveBeenCalled();
|
42
|
-
|
43
|
-
clearStack(function() { });
|
44
|
-
expect(setImmediate.calls.count()).toEqual(9);
|
45
|
-
expect(setTimeout.calls.count()).toEqual(1);
|
46
|
-
|
47
|
-
clearStack(function() { });
|
48
|
-
expect(setImmediate.calls.count()).toEqual(10);
|
49
|
-
expect(setTimeout.calls.count()).toEqual(1);
|
50
|
-
});
|
51
|
-
|
52
|
-
it("uses MessageChannels when available", function() {
|
53
|
-
var fakeChannel = {
|
54
|
-
port1: {},
|
55
|
-
port2: { postMessage: function() { fakeChannel.port1.onmessage(); } }
|
56
|
-
},
|
57
|
-
global = { MessageChannel: function() { return fakeChannel; } },
|
58
|
-
clearStack = jasmineUnderTest.getClearStack(global),
|
59
|
-
called = false;
|
60
|
-
|
61
|
-
clearStack(function() {
|
62
|
-
called = true;
|
63
|
-
});
|
64
|
-
|
65
|
-
expect(called).toBe(true);
|
66
|
-
});
|
67
|
-
|
68
|
-
it("uses setTimeout instead of MessageChannel every 10 calls to make sure we release the CPU", function() {
|
69
|
-
var fakeChannel = {
|
70
|
-
port1: {},
|
71
|
-
port2: {
|
72
|
-
postMessage: jasmine.createSpy('postMessage').and.callFake(function() {
|
73
|
-
fakeChannel.port1.onmessage();
|
74
|
-
})
|
75
|
-
}
|
76
|
-
},
|
77
|
-
setTimeout = jasmine.createSpy('setTimeout'),
|
78
|
-
global = { MessageChannel: function() { return fakeChannel; }, setTimeout: setTimeout },
|
79
|
-
clearStack = jasmineUnderTest.getClearStack(global);
|
80
|
-
|
81
|
-
clearStack(function() { });
|
82
|
-
clearStack(function() { });
|
83
|
-
clearStack(function() { });
|
84
|
-
clearStack(function() { });
|
85
|
-
clearStack(function() { });
|
86
|
-
clearStack(function() { });
|
87
|
-
clearStack(function() { });
|
88
|
-
clearStack(function() { });
|
89
|
-
clearStack(function() { });
|
90
|
-
|
91
|
-
expect(fakeChannel.port2.postMessage).toHaveBeenCalled();
|
92
|
-
expect(setTimeout).not.toHaveBeenCalled();
|
93
|
-
|
94
|
-
clearStack(function() { });
|
95
|
-
expect(fakeChannel.port2.postMessage.calls.count()).toEqual(9);
|
96
|
-
expect(setTimeout.calls.count()).toEqual(1);
|
97
|
-
|
98
|
-
clearStack(function() { });
|
99
|
-
expect(fakeChannel.port2.postMessage.calls.count()).toEqual(10);
|
100
|
-
expect(setTimeout.calls.count()).toEqual(1);
|
101
|
-
});
|
102
|
-
|
103
|
-
it("calls setTimeout when onmessage is called recursively", function() {
|
104
|
-
var fakeChannel = {
|
105
|
-
port1: {},
|
106
|
-
port2: { postMessage: function() { fakeChannel.port1.onmessage(); } }
|
107
|
-
},
|
108
|
-
setTimeout = jasmine.createSpy('setTimeout'),
|
109
|
-
global = {
|
110
|
-
MessageChannel: function() { return fakeChannel; },
|
111
|
-
setTimeout: setTimeout,
|
112
|
-
},
|
113
|
-
clearStack = jasmineUnderTest.getClearStack(global),
|
114
|
-
fn = jasmine.createSpy("second clearStack function");
|
115
|
-
|
116
|
-
clearStack(function() {
|
117
|
-
clearStack(fn);
|
118
|
-
});
|
119
|
-
|
120
|
-
expect(fn).not.toHaveBeenCalled();
|
121
|
-
expect(setTimeout).toHaveBeenCalledWith(fn, 0);
|
122
|
-
});
|
123
|
-
|
124
|
-
it("falls back to setTimeout", function() {
|
125
|
-
var setTimeout = jasmine.createSpy('setTimeout').and.callFake(function(fn) { fn() }),
|
126
|
-
global = { setTimeout: setTimeout },
|
127
|
-
clearStack = jasmineUnderTest.getClearStack(global),
|
128
|
-
called = false;
|
129
|
-
|
130
|
-
clearStack(function() {
|
131
|
-
called = true;
|
132
|
-
});
|
133
|
-
|
134
|
-
expect(called).toBe(true);
|
135
|
-
expect(setTimeout).toHaveBeenCalledWith(jasmine.any(Function), 0);
|
136
|
-
});
|
137
|
-
});
|