New in Zombie.js: DNS masking and port mapping

Two new features just landed in Zombie.js 2.0 to make testing easier: DNS masking and port mapping.

First is DNS masking, which helps you test against real domain names (instead of localhost everything), and supports testing sub-domains.

Let's say you want to test an application with the domain and the sub-domains and Just map that domain to localhost:


Go on and visit, it will send the request right to localhost.

This messes with the local DNS.lookup in Node.js, so any code that makes a request to or one of its sub-domains will end up talking to localhost. It won't affect any other program running on your machine.

Without the asterisk, only will map to localhost. And you can map as many domains as you want, you can even play with individual DNS records like:'*', 'A', '');    // IPv4'*', 'AAAA', '::1');       // IPv6'*', 'CNAME', 'localhost');'', 'MX', {
  exchange: 'localhost',
  priority: 10

Just in case you happen to be testing emails and want all emails sent to to be caught by your server.

Port mapping allows you to talk to your Web server on port 80, even though the actual server is listening on an unprivileged port, like port 3000:'*', 3000);

Even better, with one line you can tell Zombie that you want to use a root domain as the default hostname, but also support all its sub-domains, and map port 80 to your test port:

// Global setting, applies to all browser instances
Browser.localhost('*', 3000);

// Browser instance for this test
var browser = new Browser();
browser.visit('/path', function() {
  // It picks as the default host

Available now in Zombie 2.0. Since it's still Alpha (I know, I know), you'll have to check out the yet-unfinished docs.

🔥 Looking for more? Subscribe to Weekend Reading.

Or grab the RSS feed