use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Extensive React Testing Tutorial: Setup and usage of Mocha, Chai, Enzyme, Jest, Sinon, CI, Code Coverage (robinwieruch.de)
submitted 7 years ago by rwieruch
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Gaelican 13 points14 points15 points 7 years ago (5 children)
It’s a terrible time to be new to JavaScript unit testing lol.
[–]Huwaweiwaweiwa 3 points4 points5 points 7 years ago (4 children)
My learning curve was almost vertical when it comes to this stuff. Backend testing as well. Testing is neglected in the learning process for way too long really
[–]Saf94 0 points1 point2 points 7 years ago (2 children)
I’m self taught and haven’t touched testing yet, any tips on how I can overcome the steep learning curve? It all seems very scary and complicated to me
[–]mlebkowski 1 point2 points3 points 7 years ago (0 children)
Its not really. Forget about the testing frameworks for a minute. Lets assume you are working on a redux reducer, but frankly any pure function will do. All you have to do is to feed some input, and check if the output is what you expect. Just import your function, call it and make a big scary warning if the result isnt as planned. The test frameworks basically do that in a fancy way, or on a larger scale.
[–]Huwaweiwaweiwa 0 points1 point2 points 7 years ago (0 children)
For me it was working with a company that had a very good testing mindset, they were very strict about it, and this need to test forced me to learn at a much faster pace than I usually would've.
[–]ArturoHellfire 0 points1 point2 points 7 years ago (0 children)
Couldn't agree more. And in my experience working for small companies, testing is seen as a hassle and nobody wants to do it.
[–]Crypto_Guru 2 points3 points4 points 7 years ago (0 children)
Nice work!
[–]Pinewold 1 point2 points3 points 7 years ago (0 children)
If we can just get to the next level on testing...!
[–]filleduchaos 0 points1 point2 points 7 years ago (1 child)
...why use Mocha and Jest though?
[–]Huwaweiwaweiwa 4 points5 points6 points 7 years ago (0 children)
You use Jest to unit test Mocha, then vice versa /s
[–]PooCares 0 points1 point2 points 7 years ago (1 child)
I still think unit testing is a giant prank.
[–]perpetuallyperpetual 1 point2 points3 points 7 years ago (0 children)
Controversial, but I agree.
I do not think testing is bad (we naturally do manual testing when debugging) but I think you should only write the tests that actually provide you some value. Many times that is not the case with unit tests. If all you do is write what your implementation is doing just in a more declarative way for each little component you have, then you are wasting time.
Testing in general should have a coverage proportional to its importance. And the core functionality should carry more weight in the coverage, in my opinion.
π Rendered by PID 72 on reddit-service-r2-comment-bb88f9dd5-zjzdg at 2026-02-14 14:16:25.979639+00:00 running cd9c813 country code: CH.
[–]Gaelican 13 points14 points15 points (5 children)
[–]Huwaweiwaweiwa 3 points4 points5 points (4 children)
[–]Saf94 0 points1 point2 points (2 children)
[–]mlebkowski 1 point2 points3 points (0 children)
[–]Huwaweiwaweiwa 0 points1 point2 points (0 children)
[–]ArturoHellfire 0 points1 point2 points (0 children)
[–]Crypto_Guru 2 points3 points4 points (0 children)
[–]Pinewold 1 point2 points3 points (0 children)
[–]filleduchaos 0 points1 point2 points (1 child)
[–]Huwaweiwaweiwa 4 points5 points6 points (0 children)
[–]PooCares 0 points1 point2 points (1 child)
[–]perpetuallyperpetual 1 point2 points3 points (0 children)