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

Unknown macroTask scheduled in fake async test: HTMLCanvasElement.toBlob #937

Closed
eric-simonton-sama opened this issue Oct 24, 2017 · 1 comment · Fixed by #938
Closed

Comments

@eric-simonton-sama
Copy link

I get the following error testing code that uses canvas.toBlob within a fakeAsync test:

Uncaught Error: Unknown macroTask scheduled in fake async test: HTMLCanvasElement.toBlob
    at FakeAsyncTestZoneSpec.webpackJsonp.601.FakeAsyncTestZoneSpec.onScheduleTask (http://localhost:3000/packs/tests.js:5338:35)
    at ProxyZoneSpec.webpackJsonp.600.ProxyZoneSpec.onScheduleTask (http://localhost:3000/packs/tests.js:4957:39)
    at ZoneDelegate.598.ZoneDelegate.scheduleTask (http://localhost:3000/packs/polyfills.js:2706:51)
    at Zone.598.Zone.scheduleTask (http://localhost:3000/packs/polyfills.js:2537:43)
    at Zone.598.Zone.scheduleMacroTask (http://localhost:3000/packs/polyfills.js:2560:25)
    at http://localhost:3000/packs/polyfills.js:3688:37
    at HTMLCanvasElement.proto.(anonymous function) [as toBlob] (http://localhost:3000/packs/polyfills.js:3667:24)
    at http://localhost:3000/packs/application.js:33929:16
    at new ZoneAwarePromise (http://localhost:3000/packs/polyfills.js:3191:29)
    at canvasToBlob (http://localhost:3000/packs/application.js:33928:12)

I'm using Chrome 61, Zone.js 0.8.16, and Angular 4.4.6.

Should it be possible to use canvas.toBlob within a fakeAsync test? I can guess it may be fundamentally incompatible, requiring some kind of mocked toBlob backend similar to http requests, but it's hard to tell from the error message.

Thank you for a great product!

@JiaLiPassion
Copy link
Collaborator

@eric-simonton-sama , currently fakeAsyncTest does not support canvas.toBlob, I will try to make a PR to let fakeAsyncTest support it.

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Oct 25, 2017
mhevery pushed a commit that referenced this issue Dec 27, 2017
…macroTask (#938)

* fix(fakeAsyncTest): fix #937, let user be able to customize testable macroTask

* add global flag to define fakeAsyncTest macroTaskOptions

* support set callback arguments
mhevery pushed a commit to sandersn/zone.js that referenced this issue Dec 27, 2017
…stable macroTask (angular#938)

* fix(fakeAsyncTest): fix angular#937, let user be able to customize testable macroTask

* add global flag to define fakeAsyncTest macroTaskOptions

* support set callback arguments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants