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

Commit d43b4b8

Browse files
committed
fix(build): fix broken master due to setTimeout not returning a number on node
1 parent dbcfb32 commit d43b4b8

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

test/common/setInterval.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ describe('setInterval', function () {
3333
// This icky replacer is to deal with Timers in node.js. The data.handleId contains timers in
3434
// node.js. They do not stringify properly since they contain circular references.
3535
id = JSON.stringify((<MacroTask>cancelId).data, function replaceTimer(key, value) {
36-
if (value._idleNext) {
37-
return '';
38-
} else {
39-
return value;
40-
}
36+
if (key == 'handleId' && typeof value == 'object') return value.constructor.name;
37+
return value;
4138
});
4239
expect(wtfMock.log).toEqual([
4340
'# Zone:fork("<root>::WTF", "TestZone")',

test/common/setTimeout.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ describe('setTimeout', function () {
2929
// This icky replacer is to deal with Timers in node.js. The data.handleId contains timers in
3030
// node.js. They do not stringify properly since they contain circular references.
3131
id = JSON.stringify((<MacroTask>cancelId).data, function replaceTimer(key, value) {
32-
if (value._idleNext) {
33-
return '';
34-
} else {
35-
return value;
36-
}
32+
if (key == 'handleId' && typeof value == 'object') return value.constructor.name;
33+
return value;
3734
});
3835
expect(wtfMock.log).toEqual([
3936
'# Zone:fork("<root>::WTF", "TestZone")',
@@ -89,6 +86,8 @@ describe('setTimeout', function () {
8986
});
9087

9188
it('should return the timeout Id through toString', function () {
89+
// Node returns complex object from setTimeout, ignore this test.
90+
if (isNode) return;
9291
var cancelId = setTimeout(() => {
9392
}, 0);
9493
expect(typeof (cancelId.toString())).toBe('number');

0 commit comments

Comments
 (0)