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.
I’m no longer maintaining mozregression, Jeff Hammel is!
The GitHub repository has been transfered to the Mozilla organization. File issues on the new GitHub repo or ping jhammel in #ateam on irc.mozilla.org for any suggestions or concerns.
A new version of Rainbow is out. This new version contains a bunch of tiny fixes that make it 10x more useful I think:
Extract color schemes from images
Extract the color scheme from any image on the page by right-clicking the image and selecting “Extract Color Scheme”:
Preview element colors
There’s now a “Preview Element Color” context menu item that will let you quickly inspect the background/text colors of any element in Rainbow’s color picker:
View last color
View whatever color was last copied/saved from the inspector with the “View Last Color” shortcut in Rainbow’s main menu:
This version also adds a French localization courtesy of Alain Besancon and some much-needed bug fixes.
Jumping into the open source and js world has been a surprising psychological crash course/nightmare for me. There’s something about open source and open forums that encourages socially-inept jerks to deride people and software. It’s especially prevalent in certain communities. It can make you doubt yourself, or even worse, force you to adopt a behavior you don’t want to.
This can be off-putting to say the least. Your world can turn into a crazy, competitive, self-questioning altworld if you’re not careful and there are some things I’ve learned about turning that around.
Go to the right meetups. Meeting some of the people in your community in person can actually be a relief of sorts. People that sound stern on the internet are usually way nicer than expected in real life. But don’t stick around meetups or conferences that aren’t welcoming or have an “Glitterati” feel, being physically in such a high stress environment does nothing good for you, and it’s unlikely your single presence will change anything.
Follow the right people. Twitter and Github are the best things to happen to open source since IRC. But as soon as someone says a software project is “retarded”, unfollow them. Seriously, you don’t need to hear that crap. Follow people that are saying positive things, giving constructive criticism, encouraging people, giving propers where propers are due.
Don’t let anyone cramp your style. Feedback is important and of course you should listen to it. If someone says something negative about your project in an unreasonable way, don’t take it to heart. There’s something good in every project (it’s open source, it already has one thing going for it), no single project is complete crap, keep the good things and learn from the criticism.
All this boils down to basically “surround yourself with good people”, it’s advice that applies to everything, but it’s good to remember that it’s just as important to apply it to your work and hobbies. Tina Fey (<3) sums it up in Bossypants (<3):
When faced with sexism or ageism or lookism or even really aggressive Buddhism, ask yourself the following question: “Is this person in between me and what I want to do?” If the answer is no, ignore it and move on. Your energy is better used doing your work and outpacing people that way. Then, when you’re in charge, don’t hire the people who were jerky to you.
If the answer is yes, you have a more difficult road ahead of you. I suggest you model your strategy after the old Sesame Street film piece “Over! Under! Through!”
Again don’t waste your energy trying to educate or change opinions. Go “Over! Under! Through!” and opinions will change organically when you’re the boss. Or they won’t. Who cares?
Do your thing and don’t care if they like it.
This brings an important point, sometimes you can’t avoid collaborating on a project with a smartass. Take the high road and don’t ever respond to snarkiness with snarkiness. If you get anything from this blog post it’s…don’t let it change you.