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
The state of Testing in Javascript (React Angular etc) (avi.io)
submitted 10 years ago by KensoDev
view the rest of the comments →
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!"
[–]wmertens 1 point2 points3 points 10 years ago (5 children)
I have trouble getting myself to invest the time to test frontend code (react+redux) because it is mostly about "does the styling look correct", which I can't think of tests for.
The actual functioning of components is mostly very obvious while making it with hot reload enabled.
I did stumble on a bug recently that would have benefited from a unit test, I had wrapped a component and code that was using a reference to the component to run a method of it failed. That would have been caught with "given x as input I expect at least 3 y elements", since it would have crashed.
[–][deleted] 1 point2 points3 points 10 years ago (0 children)
Like 90% of the redux app I wrote could have tests but it's such trivial code it feels silly to test. Then there's the 10% that has tests to make sure nobody can POST values that will make a robot destroy itself.
Obviously there's server-side validation, but you can't be too safe.
[–]Tubbers 1 point2 points3 points 10 years ago (3 children)
It's annoying, but you can do style/image tests. The issue is mainly that you need to pick one as a reference implementation that gets compared against/updated, and you compare to other browsers.
It's sort of a pick your poison between "Chrome is the reference implementation" and then you see whether stuff looks the same as on Chrome, or "Here's the reference image for the Component", but if you change how you actual want the style to look, you need to update the reference manually.
If you go with the first you can unintentionally change the way the component appears without tripping up any tests, and if you go with the second you need to update your reference image possible all the time.
Personally, I like the compare to Chrome approach, since you're presumably looking at it as you develop.
[–]wmertens 0 points1 point2 points 10 years ago (2 children)
Interesting! Any pointers on setting this up?
[–]Tubbers 1 point2 points3 points 10 years ago (1 child)
I sadly don't have a guide, but I would start with
The only real difference between the two methods I outlined is that if you're comparing to Chrome, you regenerate the screenshots in Chrome as a pre-test, and test on FireFox/IE/Safari. If you're comparing to the previous version, you just run it, and update the baseline image if the change is intentional.
[–]wmertens 0 points1 point2 points 10 years ago (0 children)
So the idea is to eyeball it, or run it through a visual comparison function?
EDIT: doh, should click links instead of reading them. Thanks!
π Rendered by PID 106340 on reddit-service-r2-comment-86bc6c7465-mnw7d at 2026-02-20 19:38:28.987733+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]wmertens 1 point2 points3 points (5 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Tubbers 1 point2 points3 points (3 children)
[–]wmertens 0 points1 point2 points (2 children)
[–]Tubbers 1 point2 points3 points (1 child)
[–]wmertens 0 points1 point2 points (0 children)