diff --git a/test/common/setInterval.spec.ts b/test/common/setInterval.spec.ts index 0d3ee2f28..e520877d1 100644 --- a/test/common/setInterval.spec.ts +++ b/test/common/setInterval.spec.ts @@ -33,11 +33,8 @@ describe('setInterval', function () { // This icky replacer is to deal with Timers in node.js. The data.handleId contains timers in // node.js. They do not stringify properly since they contain circular references. id = JSON.stringify((cancelId).data, function replaceTimer(key, value) { - if (value._idleNext) { - return ''; - } else { - return value; - } + if (key == 'handleId' && typeof value == 'object') return value.constructor.name; + return value; }); expect(wtfMock.log).toEqual([ '# Zone:fork("::WTF", "TestZone")', diff --git a/test/common/setTimeout.spec.ts b/test/common/setTimeout.spec.ts index 0119eea62..0623f603d 100644 --- a/test/common/setTimeout.spec.ts +++ b/test/common/setTimeout.spec.ts @@ -29,11 +29,8 @@ describe('setTimeout', function () { // This icky replacer is to deal with Timers in node.js. The data.handleId contains timers in // node.js. They do not stringify properly since they contain circular references. id = JSON.stringify((cancelId).data, function replaceTimer(key, value) { - if (value._idleNext) { - return ''; - } else { - return value; - } + if (key == 'handleId' && typeof value == 'object') return value.constructor.name; + return value; }); expect(wtfMock.log).toEqual([ '# Zone:fork("::WTF", "TestZone")', @@ -89,6 +86,8 @@ describe('setTimeout', function () { }); it('should return the timeout Id through toString', function () { + // Node returns complex object from setTimeout, ignore this test. + if (isNode) return; var cancelId = setTimeout(() => { }, 0); expect(typeof (cancelId.toString())).toBe('number');