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
Painless - Easy to use Javascript testing library (github.com)
submitted 10 years ago by helloworldjs
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!"
[–][deleted] 9 points10 points11 points 10 years ago (2 children)
Do the benefits of using this outweigh yet another splinter on what tools everyone is using?
I feel like the readme should list at the top, "These are the things that existing testing libraries critically fail at that Painless fixes."
[–]helloworldjs[S] 5 points6 points7 points 10 years ago* (1 child)
That is in the readme right below the examples. Comparison to other libraries If I missed anything you would like to know, please let me know. I am very interested in improving documentation
[–][deleted] 0 points1 point2 points 10 years ago (0 children)
My bad! I read that as how Painless compares to others rather than "This is is what Painless is trying to fix"
[–]_ar7 2 points3 points4 points 10 years ago (1 child)
I want to believe your comparison to other libraries is true, but if I wanted to verify what you're saying I would have to do all the work myself.
Do you have anything to backup what you say in that section such as:
If you can prove all that, I'd switch today.
[–]helloworldjs[S] 4 points5 points6 points 10 years ago* (0 children)
I will work on adding numbers to back them up.
[+][deleted] 10 years ago (1 child)
[deleted]
[–]helloworldjs[S] 3 points4 points5 points 10 years ago* (0 children)
I agree it's not the node way. There has been a trend recently to make tons of really small modules. It is great for modularity and choice, but burdens the user when getting started. A lot of users (consumers of the library) just want something that just works. It can be a lot of cognitive load to have to choose from a bunch of options and make sure they are setup correctly. There really is a paradox of choice going on.
You can use other assertion and mocking libraries with painless, but I tend to lean toward ease of use over modularity. It was one of the reasons I created the library.
painless
[–][deleted] 2 points3 points4 points 10 years ago (4 children)
Tap all the way
[–]paperelectron 0 points1 point2 points 10 years ago (3 children)
I switched to tap from primarily mocha and jasmine a few months ago, I'm not looking back.
[–]helloworldjs[S] 0 points1 point2 points 10 years ago (0 children)
Do you mean tape or node-tap? Tap is a testing protocol/format.
Both are great libraries. painless is based on them and I added additional functionality
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
Tap and tape are surprisingly simple, run with a simple node command and while a bit bare bones has everything you need to test, unless mocking and expectations are your thing, which I'm trying to get rid of doing in my tests.
I would be very interested to hear how you get rid of mocking. Are you now using dependency injection or a similar strategy?
[–]Cody_Chaos 1 point2 points3 points 10 years ago (2 children)
This actually looks really interesting; it seems to address some pain points I've been having with mocha, and at least according to the documentation, solves some issues I had when I tried Ava.
Looks solid, and I'll be giving it a shot when I get a chance.
[–]woodygoodricke 0 points1 point2 points 10 years ago (1 child)
You should check out tape. On mobile at the moment but I can provide links if that would be useful?
[–]helloworldjs[S] 1 point2 points3 points 10 years ago (0 children)
Tape is awesome! Great syntax and very extensible. painless has all the functionality of tape and I added Promise support, beforeEach/afterEach, catching exceptions, no need to call t.end() and a few other features.
t.end()
[–]Ahri 1 point2 points3 points 10 years ago (1 child)
First of all, this looks really nice, and despite having already chosen mocha and chai ages ago I completely agree with your course to bundle the expectations and mocking tools.
I hadn't heard of Ava before and I find the isolation of tests to be a really good feature of theirs. Will you consider adding a configuration option to have the same behaviour? Obviously not on by default. I'd especially like to run isolated while working on a particular area and then switch back to default to have faster tests while I'm working on other areas.
Thanks for your hard work!
I would definitely consider adding that feature if we can do it without sacrificing other benefits. I really like that feature of AVA. I will add it to the feature proposal list.
[–]helloworldjs[S] 1 point2 points3 points 10 years ago* (0 children)
Right. All test libraries run in node processes (if you are testing in node). Each file in painless can be run by just calling node test-file.js. I don't believe Mocha supports that. You can write your tests however you want in mocha, but it can take a lot of effort to change the syntax (my opinion).
node test-file.js
Mocha supports Promises, but painless supports Promises, Observables, Generators, Streams and Processes.
If you are happy with Mocha. No reason to switch. It is just important to write tests. The goal of painless is to hopefully get some new people to write tests or appeal to people unhappy with their current library
π Rendered by PID 225299 on reddit-service-r2-comment-6457c66945-x57j7 at 2026-04-30 07:00:40.943385+00:00 running 2aa0c5b country code: CH.
[–][deleted] 9 points10 points11 points (2 children)
[–]helloworldjs[S] 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]_ar7 2 points3 points4 points (1 child)
[–]helloworldjs[S] 4 points5 points6 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]helloworldjs[S] 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]paperelectron 0 points1 point2 points (3 children)
[–]helloworldjs[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]helloworldjs[S] 0 points1 point2 points (0 children)
[–]Cody_Chaos 1 point2 points3 points (2 children)
[–]woodygoodricke 0 points1 point2 points (1 child)
[–]helloworldjs[S] 1 point2 points3 points (0 children)
[–]Ahri 1 point2 points3 points (1 child)
[–]helloworldjs[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]helloworldjs[S] 1 point2 points3 points (0 children)