DEV Community

Discussion on: Simple and effective: Unit-testing Alpine.js components with Jest ⏱️⏩

Collapse
thormeier profile image
Pascal Thormeier Author • Edited

That's an awesome package you built there, a much simpler alternative to using Puppeteer! Are calls of magic methods also inspectable or do they still require some manual labour to be mocked?

Mind if I add a link to the package to the post itself?

Collapse
hugo__df profile image
Hugo Di Francesco

I haven't tried to mock the magic methods, but all the stuff your code sticks on the instance is exposed under $data

A link in the post would be great!

Also a quick note re- puppeteer, Alpine.js itself is tested using Jest with baked in JSDOM (& that's also what test-utils uses) so that's another piece of the puzzle between JS-only unit tests and E2E tests with puppeteer or Cypress