I heard that if you have a really hard time deciding between two things, it can’t be that important of a decision. That might be the situation I’m in right now, where I am once again wondering: Which node.js testing framework should I use? I’m completely torn between a few similar options that would all work fine.
In the past I’ve gone on #nodejs on freenode to ask what the latest thing is. At this point I’ve asked so many times that I’d be embarassed to ask again.
My requirements are:
- It has a CLI that you can point to a directory of tests, and it will intelligently run all the tests in that directory.
- It supports async testing, with some method of “waiting” for an async test to complete.
I used it for my brain and classifier projects: test directory.
A test looks like: https://github.com/harthur/classifier/blob/master/test/unit/redis.js.
Don’t like: You can only do one async thing per ‘test’ (e.g. “it” statement). Sometimes I want to do multiple things to test basically the same thing, but maybe I’m using it wrong (update: I was using it wrong).
Used it for replace: test directory.
A test looks like: https://github.com/harthur/replace/blob/master/test/sanity.js
Don’t like: the output! It’s not human readable.
Used it for nomnom: test directory.
A test looks like: https://github.com/harthur/nomnom/blob/master/test/callback.js
Don’t like: there was some reason I stopped using nodeunit and started looking for other frameworks a couple years ago. The tests themselves don’t look as nice as the others, having to call test.done() at the end of every test.
I like writing tape tests the most, but I don’t know if I can handle looking at the tap output.
So what do I use now? It probably doesn’t matter that much.
Update: I picked mocha, because it seemed the best maintained one, and I’m glad I did.
A few months ago I created Bugzilla Todos out of a need to see all the Bugzilla-related things I had to do in one place, and also quickly see what other people had to do (for example, when picking someone to review a patch).
It’s a basic UI that shows your review and flag requests, patches to check in, unfulfilled requests you made of other people, and assigned bugs. I just added a few features that I desperately wanted for it:
Live Updates: Bztodos now checks Bugzilla periodically for any new requests, and shows notifications of these new requests:
It shows the count of the new requests in the favicon (thanks to the tinycon library), and highlights new items in the list. It checks every 15 mintues. I hope that’s okay with Mozilla’s Bugzilla.
Remember Last Tab: When you visit the page again, the last tab you had selected will be open by default.
Keyboard shortcuts: Visit the ‘Review’ tab by simply typing ‘r’ when the page is focused. The shortcuts are based on the first letter of the tab, and ‘p’ for the ‘Respond’ tab.
The Bugzilla queries used to fetch these queues are always in need of tweaking for unforseen situations. Please file an issue if the wrong items are showing up in a tab, and especially if something is missing. Also file if there are any suggestions at all.
My last blog post was quite a downer, so I want to do a short follow up for posterity.
First of all, there were some nice responses to it from Steve Klabnik and especially Corey Haines, who gave a sincere straight-up apology. Several people have told me they are usually very nice, so keep that in mind.
The emails I got really stuck out to me. Some people had their own stories that were way worse than mine. Sadly, several said that this is why they’d never open sourced anything.
But I also got emails with people telling me how useful they’d found some of my open source projects. That right there makes it all worth it. Make sure you let people know when you appreciate their work, it might help balance out some of the bad.
I want to make it clear that you should definitely still open source your code. I still wouldn’t hesitate to open source something if I thought it could be useful to someone.
Yesterday my colleague mentioned that a script I wrote was getting a lot of attention on Twitter. This particular project was something I wrote a couple years ago to help me out with a workflow. I had a lot of fun writing it and have gotten a ton of use out of it, and several people have expressed that they have too. I’d put it up on Github, so that others could potentially use it or use the code.
So I went to see what people were saying about this project. I searched Twitter and several tweets came up. One of them, I guess the original one, was basically like “hey, this is cool”, but then the rest went like this:
At this point, all I know is that by creating this project I’ve done something very wrong. It seemed liked I’d done something fundamentally wrong, so stupid that it flabbergasts someone. So wrong that it doesn’t even need to be explained. And my code is so bad it makes people’s eyes bleed. So of course I start sobbing.
Then I see these people’s follower count, and I sob harder. I can’t help but think of potential future employers that are no longer potential. My name and avatar are part of its identity, and it’s just one step for a slightly curious person to see the idiot behind this project.
I queried some tweeters for more information on why exactly it was so bothersome. I didn’t get apologies from these tweeters.
The response to this from other people was overwhelmingly reassuring. The tweets were called out by several people, and I got a bunch of reassurance and support. I’m lucky to have friends in this industry that know me in person and through my work, and thus feel more compelled to speak up.
I evangelize open source whenever I meet new coders or go to meetups. I tell them to make something that they would find useful and put it out there. Can you imagine if one of these new open sourcerers took my advice and got this response, without the support I had. Can you imagine?
I got some apologies: http://programmingtour.blogspot.com/2013/01/im-sorry.html, http://blog.steveklabnik.com/posts/2013-01-23-node, and I wrote a follow up post here: http://harthur.wordpress.com/2013/02/01/open-source-rocks-follow-up/
Also, it was hard for me to convey this, but the snarkiness of the tweets really made it so much worse. I wish I could explain why.
I’m always filing bugs, and I usually know the Bugzilla component they’re supposed to go in. So I made a shortcut to get around the hoops of picking a component on the Bugzilla form. It’ll autocomplete on product and component name for faster filing:
I also often search for bugs by summary in a component, so I made a shortcut for that too. You can search for open, closed, or both:
I’m interested in the common fields other people use when searching for bugs, so if you have any insight leave a comment.
Makes 1 1/2 quarts of ice cream.
2oz cream cheese, softened
3/4 cup sugar
1/2 cup fresh lemon juice
2 tbsp lemon zest
1/4 tsp vanilla extract
1 1/2 cup whole milk
1 cup heavy cream
pinch of salt
Mix the cream cheese and sugar. Add the lemon juice, lemon zest, salt and vanilla and mix well. Wisk in the milk and cream. Pour in your ice cream maker and use according to directions.
Nightly Tester Tools is an addon for Firefox nightly and beta testers. I’m the current maintainer of the addon, having been passed down the torch by Dave Townsend. It’s at the point where I no longer have time to give Nightly Tester Tools the attention it deserves.
Nightly Tester Tools has been around for a long time. It’s provided tools like build id copying, screenshots, and test crashing. The code is currently on Github, and there’s a Bugzilla component Other Applications/Nightly Tester Tools Where people file bugs.
Maintenance mainly involves bumping the version compatiblity on AMO every time there’s a new Firefox release and checking out new bugs or feature requests that come in.
This is a great opportunity for a nightly tester to build onto a tool that helps out thousands (NTT has about 100,000 users) of testers, and learn some extension development at the same time.
Please get in touch if you’re interested. I’m harth on #ateam on irc.mozilla.org and always available to answer questions about it and guide anyone along about the process.