jasmine-core 2.6.3 → 2.6.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c673112abd7b640e9bd6b9cf88f17880f8a64a0f
|
4
|
+
data.tar.gz: a05601e46292ec06611cfd192eff15c0fbd03f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3a294a022aa965aaf9f16475003f0901f8a1724b340575a6cfac372d9008cc153109c5888bec22525e8e8fdd8849effb7a843db02bd21955dcc26384ce8d6b
|
7
|
+
data.tar.gz: 8b02dfb58fa1dfd5eaec2d4f4150dfc55625c9f30b4c1e0e64e736297141b7ce8da156273e9b4e941666fe3cc3f7146f3c2aedf9f21f6af111122354a67a1de6
|
data/lib/jasmine-core/jasmine.js
CHANGED
@@ -1600,7 +1600,9 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
|
1600
1600
|
};
|
1601
1601
|
|
1602
1602
|
getJasmineRequireObj().clearStack = function(j$) {
|
1603
|
-
|
1603
|
+
var maxInlineCallCount = 10;
|
1604
|
+
|
1605
|
+
function messageChannelImpl(global, setTimeout) {
|
1604
1606
|
var channel = new global.MessageChannel(),
|
1605
1607
|
head = {},
|
1606
1608
|
tail = head;
|
@@ -1623,25 +1625,44 @@ getJasmineRequireObj().clearStack = function(j$) {
|
|
1623
1625
|
}
|
1624
1626
|
};
|
1625
1627
|
|
1628
|
+
var currentCallCount = 0;
|
1626
1629
|
return function clearStack(fn) {
|
1627
|
-
|
1628
|
-
|
1630
|
+
currentCallCount++;
|
1631
|
+
|
1632
|
+
if (currentCallCount < maxInlineCallCount) {
|
1633
|
+
tail = tail.next = { task: fn };
|
1634
|
+
channel.port2.postMessage(0);
|
1635
|
+
} else {
|
1636
|
+
currentCallCount = 0;
|
1637
|
+
setTimeout(fn);
|
1638
|
+
}
|
1629
1639
|
};
|
1630
1640
|
}
|
1631
1641
|
|
1632
1642
|
function getClearStack(global) {
|
1643
|
+
var currentCallCount = 0;
|
1644
|
+
var realSetTimeout = global.setTimeout;
|
1645
|
+
var setTimeoutImpl = function clearStack(fn) {
|
1646
|
+
Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]);
|
1647
|
+
};
|
1648
|
+
|
1633
1649
|
if (j$.isFunction_(global.setImmediate)) {
|
1634
1650
|
var realSetImmediate = global.setImmediate;
|
1635
1651
|
return function(fn) {
|
1636
|
-
|
1652
|
+
currentCallCount++;
|
1653
|
+
|
1654
|
+
if (currentCallCount < maxInlineCallCount) {
|
1655
|
+
realSetImmediate(fn);
|
1656
|
+
} else {
|
1657
|
+
currentCallCount = 0;
|
1658
|
+
|
1659
|
+
setTimeoutImpl(fn);
|
1660
|
+
}
|
1637
1661
|
};
|
1638
1662
|
} else if (!j$.util.isUndefined(global.MessageChannel)) {
|
1639
|
-
return messageChannelImpl(global);
|
1663
|
+
return messageChannelImpl(global, setTimeoutImpl);
|
1640
1664
|
} else {
|
1641
|
-
|
1642
|
-
return function clearStack(fn) {
|
1643
|
-
Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]);
|
1644
|
-
};
|
1665
|
+
return setTimeoutImpl;
|
1645
1666
|
}
|
1646
1667
|
}
|
1647
1668
|
|
@@ -4976,5 +4997,5 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|
4976
4997
|
};
|
4977
4998
|
|
4978
4999
|
getJasmineRequireObj().version = function() {
|
4979
|
-
return '2.6.
|
5000
|
+
return '2.6.4';
|
4980
5001
|
};
|
@@ -21,6 +21,34 @@ describe("ClearStack", function() {
|
|
21
21
|
expect(setImmediate).toHaveBeenCalled();
|
22
22
|
});
|
23
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
|
+
|
24
52
|
it("uses MessageChannels when available", function() {
|
25
53
|
var fakeChannel = {
|
26
54
|
port1: {},
|
@@ -37,6 +65,41 @@ describe("ClearStack", function() {
|
|
37
65
|
expect(called).toBe(true);
|
38
66
|
});
|
39
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
|
+
|
40
103
|
it("calls setTimeout when onmessage is called recursively", function() {
|
41
104
|
var fakeChannel = {
|
42
105
|
port1: {},
|
@@ -952,16 +952,15 @@ describe("Env integration", function() {
|
|
952
952
|
});
|
953
953
|
|
954
954
|
describe("with a mock clock", function() {
|
955
|
-
var originalTimeout;
|
956
|
-
|
957
955
|
beforeEach(function() {
|
958
|
-
originalTimeout = jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL;
|
956
|
+
this.originalTimeout = jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL;
|
957
|
+
this.realSetTimeout = setTimeout;
|
959
958
|
jasmine.clock().install();
|
960
959
|
});
|
961
960
|
|
962
961
|
afterEach(function() {
|
963
962
|
jasmine.clock().uninstall();
|
964
|
-
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
963
|
+
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = this.originalTimeout;
|
965
964
|
});
|
966
965
|
|
967
966
|
it("should wait a specified interval before failing specs haven't called done yet", function(done) {
|
@@ -1080,7 +1079,8 @@ describe("Env integration", function() {
|
|
1080
1079
|
|
1081
1080
|
it('should wait a custom interval before reporting async functions that fail to call done', function(done) {
|
1082
1081
|
var env = new jasmineUnderTest.Env(),
|
1083
|
-
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone', 'suiteDone', 'specDone'])
|
1082
|
+
reporter = jasmine.createSpyObj('fakeReport', ['jasmineDone', 'suiteDone', 'specDone']),
|
1083
|
+
realSetTimeout = this.realSetTimeout;
|
1084
1084
|
|
1085
1085
|
reporter.jasmineDone.and.callFake(function() {
|
1086
1086
|
expect(reporter.specDone).toHaveFailedExpecationsForRunnable('suite beforeAll times out', [
|
@@ -1110,6 +1110,11 @@ describe("Env integration", function() {
|
|
1110
1110
|
jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
1111
1111
|
|
1112
1112
|
env.describe('suite', function() {
|
1113
|
+
env.afterAll(function() {
|
1114
|
+
realSetTimeout(function() {
|
1115
|
+
jasmine.clock().tick(10);
|
1116
|
+
}, 100);
|
1117
|
+
});
|
1113
1118
|
env.describe('beforeAll', function() {
|
1114
1119
|
env.beforeAll(function(innerDone) {
|
1115
1120
|
jasmine.clock().tick(5001);
|
data/lib/jasmine-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Van Hove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|