dimanche 4 octobre 2020

How to configure a module for testing matFormField in matDialog?

I write test for form in dialog, but I always have an error, when run my test.

Reason - tag mat-form-field in mat-dialog.

Mb I'a wrong in mock for providers.

I use nrwl (jest, cypress). I also use ts-mockito.

Error:

 UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'element' -> object with constructor 'Object'
    |     property 'publicProviders' -> object with constructor 'Object'
    |     property 'NgIf_120' -> object with constructor 'Object'
    --- property 'parent' closes the circle
    at JSON.stringify (<anonymous>)
    at process.target._send (internal/child_process.js:778:25)
    at process.target.send (internal/child_process.js:676:19)
    at reportSuccess (K:\programming\nx-test\test\node_modules\jest-runner\node_modules\jest-worker\build\workers\processChild.js:67:11)
(node:12024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My example-code (in stackblitz): https://stackblitz.com/edit/angular-ivy-j12nec?file=src%2Fapp%2Fdialog%2Fmodal%2Fmodal.component.spec.ts

Aucun commentaire:

Enregistrer un commentaire