5 ms·
Clickbait, hard skip. Jest is the best testing framework I have ever worked with, every other testing framework should learn from it (seriously). Iterating on t
by stevebmark 3y ago
Clickbait, hard skip. Jest is the best testing framework I have ever worked with, every other testing framework should learn from it (seriously). Iterating on tests in watch mode is a joy.
- golergka 3y agoHave you tried vitest?
- rozenmd 3y agoIf you love iterating on tests in watch mode, Vitest will feel even better: https://maxrozen.com/beginners-guide-to-react-testing/react-testing-tools-how-to-use-them https://maxrozen.com/beginners-guide-to-react-testing/react-...
- yakshaving_jgt 3y agoNot being sarcastic, but what qualifies your opinion? i.e., which other testing frameworks and/or language environments have you used?
- danpalmer 3y agoI’d love to hear more about your reasoning because it’s not the experience I’ve had, but I’ve heard it before and would like to understand it more. I personally found Jest to do a lot of magic that, as an only occasional contributor to JS codebases, made it somewhat impenetrable. As a comparison, many testing libraries look a lot like Python’s unittest if you squint, a design originated in the Java ecosystem I think. I find I can move between testing many languages and be immediately productive with test and know how things work, which is a huge productivity bonus. Alternatively, I’ve found pytest’s dependency injection makes writing tests really nice and easy, the whole lifecycle management is very good. I’d even consider coordinating integration tests with it if I was just running precompiled binaries etc.
- stevebmark 3y agoThe specific workflow for Jest I really enjoy: - Opening an editor split with a terminal - Running Jest in watch mode - Using a pattern to pick specific test(s) at a time - Editing tests and code to either fix bugs or add features, and watching the test quickly re-run every save Specifically the watch interface of Jest, which seems pretty simple, is great. It's a joyful way to work on code. Any test runner that doesn't support this workflow is a nightmare. And I don't get why many test runners don't support this workflow, it seems pretty easy to implement.
- jeffkeen 3y agoI’d love to see how you use it. My encounters with jest have been painful, and it seemed unnecessarily cruel to run browser tests in node, where you couldn’t just easily put a debugger statement in there and use the inspector to see what was going on.
- c-hendricks 3y agoYou can debug Jest tests in Chrome use node's included inspector. Ironically it's vitest that doesn't support this (IIRC, haven't checked in a minute)
- jeffkeen 3y agooh thanks for that tip!
- c-hendricks 3y agoMissed the edit window, but looks like I'm outdated: vitest does support node's debugger https://vitest.dev/guide/debugging.html https://vitest.dev/guide/debugging.html