5 ms·
I have a strange history with JS test libraries. Of the 4 that I've used, I've fixed bugs in 3 of them within a week of first picking it up. QUnit, Sinon and Je
by wwalser 10y ago
I have a strange history with JS test libraries. Of the 4 that I've used, I've fixed bugs in 3 of them within a week of first picking it up. QUnit, Sinon and Jest.
This isn't commentary on the quality of Jest. After turning off auto-mocking and instead only using the mocking when I really needed it, I ended up using it for a moderately successful side project and enjoyed the experience.
- andrewstuart2 10y agoHave you used jasmine + karma? That's been, and still is, my go-to for solid and fast testing.
- dancek 10y agoIt's solid once you get everything set up, but that takes me a while. Of course I've only set it up for a couple of projects, using different build systems, and having tried other test libraries in between in order to minimize the chances of my remembering anything... I think there's room for one or two test frameworks that Just Work. Surely you'll lose some configurability, but mostly you don't need it.
- wwalser 10y agoI have used Jasmine+Karma. It's good stuff. It doesn't have the the "awesome stuff baked in" feel that Jest gives but it also doesn't give you a headache when something baked in doesn't work as expected :).
- mambodog 10y agoAutomocking is off by default now, and a lot of work has been done to improve the developer experience in recent times.
- wwalser 10y agoThanks for the work you & the team have put into Jest. While I haven't used it recently, I'm glad that it's out there as an option. The _ability_ to mock easily was always super great.
- cel1ne 10y agoI switched to tape (the "Test anything protocol" from 1987) and never looked back: https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4 https://medium.com/javascript-scene/why-i-use-tape-instead-o... I use faucet for pretty-printing the output.
- Noseshine 10y agoFor people who want to use tape and have TAP support and are using a Jetbrains IDE, vote for TAP support on this ticket: "Add support for tests that output Test Anything Protocol (TAP)" https://youtrack.jetbrains.com/issue/WEB-20916 https://youtrack.jetbrains.com/issue/WEB-20916
- chriswarbo 10y agoAfter discovering TAP a while back I switched a bunch of tests to output in that format, but found that it can't actually be consumed by anything, other than pretty printers (too trivial to bother) or smolder (Web server; too much overkill). I think there's definitely space for some local commands which graph, analyse, etc. a bunch of TAP, but I haven't found anything like that :(
- cel1ne 10y agoI never had the need to process the output, I just liked the simple structure of my tests and the plan/count/end system.
- sjclemmy 10y agoI hear you. I've set up testing for angular apps and whilst I don't mind the unit testing with karma/jasmine, when I've used Protractor I've found it unbearable; some functions are exposed as promises, some are not, some are resolved in the 'it' statement, some are not and you have to chain a 'then' and it's anyones guess as to how a particular function behaves.
- draw_down 10y agoYeah, tape is nice. I don't think Sinon is really the same kind of thing- at least when I used it, it was for things like mocking XHR responses.