Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enzyme shallow rendering for Angular2?

Trying to test my UI components without rendering the whole child component tree inside, it was super easy to do in react/enzyme - is there anything similar in Angular2 world?

like image 348
Andrey Selitsky Avatar asked Oct 31 '25 01:10

Andrey Selitsky


1 Answers

https://github.com/getsaf/shallow-render https://www.npmjs.com/package/shallow-render

I am the developer for shallow-render. I was a big fan of the enzyme model and you'll see a lot of similarities.

The goals I set out to solve were: * Automatically follow the dependency tree by following the Angular module tree. * Render ONLY the component in-test (everything else is a mock that shallow-renders).

It currently supports Angular 5x and will follow future Angular releases as they come out.

like image 116
getsaf Avatar answered Nov 02 '25 14:11

getsaf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!