Unit Testing with Jest & Angular 10: "Uncaught (in promise): Error: Not supported"
See original GitHub issueI cannot unit test a component that uses Quill as I am getting this error:
Uncaught (in promise): Error: Not supported Error: Not supported at QuillService.<anonymous> (projects/ngx-quill/src/lib/quill.service.ts:25:29)
I am configuring Quill like this in my spec.ts file:
import { QuillModule } from 'ngx-quill';
...
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ... ],
imports: [ ... ],
providers: [QuillModule.forRoot().providers],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
.compileComponents();
fixture = TestBed.createComponent(...);
component = fixture.componentInstance;
fixture.detectChanges();
}));
I am not testing Quill elements; at this point, even a dummy test does not pass because of this error.
If I comment out the fixture.detectChanges()
line above, the test passes correctly.
Thank you for any suggestions!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Angular + Jest: Error: Uncaught (in promise): Failed to load C ...
Unfortunately, I can't get Jest to work. I want to use it to build unit tests for my Angular webapp. I just noticed...
Read more >Async in unit tests does not handle unresolved promises #20827
This test should fail, but because the promise is never resolved and the test does not wait for it to be resolved it...
Read more >Testing services - Angular
Here are some synchronous and asynchronous unit tests of the ValueService written without assistance from Angular testing utilities. app/demo/demo.spec.ts
Read more >Successfully Throwing Async Errors with the Jest Testing Library
Below is a very, very simplified version of the React component I needed to unit test with Jest. I'll break down what its...
Read more >Mocha - the fun, simple, flexible JavaScript test framework
simple, flexible, fun. Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yes it looks fine.
i think maybe it has something todo with your jest config.
maybe you could identify the real cause. i would guess that jest can not handle the
async import
in the service.sounds like a missing polyfill for promises?
which version of angular and ngx-quill do you use?
my unit tests are running without any problem