diff --git a/lib/zone.ts b/lib/zone.ts index 992410575..d144588ad 100644 --- a/lib/zone.ts +++ b/lib/zone.ts @@ -1151,6 +1151,10 @@ const Zone: ZoneType = (function(global: any) { } class ZoneAwarePromise implements Promise { + static toString() { + return 'function ZoneAwarePromise() { [native code] }'; + } + static resolve(value: R): Promise { return resolvePromise(>new this(null), RESOLVED, value); } diff --git a/test/common/Promise.spec.ts b/test/common/Promise.spec.ts index 2137235b4..423310849 100644 --- a/test/common/Promise.spec.ts +++ b/test/common/Promise.spec.ts @@ -55,6 +55,10 @@ describe( log = []; }); + it('should pretend to be a native code', () => { + expect(String(Promise).indexOf('[native code]') >= 0).toBe(true); + }); + it('should make sure that new Promise is instance of Promise', () => { expect(Promise.resolve(123) instanceof Promise).toBe(true); expect(new Promise(() => null) instanceof Promise).toBe(true);