Nice writeup in terms of writing isolated unit tests for component logic.
For anyone interested in testing the full component (including rendering logic) I've purpose built the following package github.com/HugoDF/alpine-test-utils.
Passionate full stack web developer, course author for Educative, book author for Packt, he/him.
Find my work and get to know me on my Linktree: https://linktr.ee/thormeier
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?
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
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice writeup in terms of writing isolated unit tests for component logic.
For anyone interested in testing the full component (including rendering logic) I've purpose built the following package github.com/HugoDF/alpine-test-utils.
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?
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