Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit e3cd1f4

Browse files
JiaLiPassionmhevery
authored andcommitted
fix: #604, sometimes setInterval test spec will fail on Android 4.4 (#605)
1 parent 95ad315 commit e3cd1f4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: test/common/setInterval.spec.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ describe('setInterval', function() {
1616
const testZone = Zone.current.fork(Zone['wtfZoneSpec']).fork({name: 'TestZone'});
1717
testZone.run(() => {
1818
let id;
19+
let intervalCount = 0;
1920
const intervalFn = function() {
21+
intervalCount++;
2022
expect(Zone.current.name).toEqual(('TestZone'));
2123
global[zoneSymbol('setTimeout')](function() {
24+
const intervalUnitLog = [
25+
'> Zone:invokeTask:setInterval("<root>::ProxyZone::WTF::TestZone")',
26+
'< Zone:invokeTask:setInterval'
27+
];
28+
let intervalLog = [];
29+
for (let i = 0; i < intervalCount; i++) {
30+
intervalLog = intervalLog.concat(intervalUnitLog);
31+
}
2232
expect(wtfMock.log).toEqual([
2333
'# Zone:fork("<root>::ProxyZone::WTF", "TestZone")',
2434
'> Zone:invoke:unit-test("<root>::ProxyZone::WTF::TestZone")',
2535
'# Zone:schedule:macroTask:setInterval("<root>::ProxyZone::WTF::TestZone", ' + id + ')',
26-
'< Zone:invoke:unit-test',
27-
'> Zone:invokeTask:setInterval("<root>::ProxyZone::WTF::TestZone")',
28-
'< Zone:invokeTask:setInterval'
29-
]);
36+
'< Zone:invoke:unit-test'
37+
].concat(intervalLog));
3038
clearInterval(cancelId);
3139
done();
3240
});

0 commit comments

Comments
 (0)