I'd generally go "as small as possible".
If you're doing DOM things, that means you're going to need to test against a DOM implementation -- a browser, even headless, like phantom, or a non-browser DOM like JSDOM. I'd generally make a package (especially to publish on the npm registry) like so:
package.json
{
"name": "mylibrary",
....
"main": "mylibrary.js",
"devDependencies": {
"jsdom": "^1",
"tape": "^2"
}
"scripts": { "test": "tape test.js" }
}
mylibrary.js
do things with the DOM
test.js
var dom = require('jsdom');
var test = require('tape');
...
set up dom here, loading your mylibrary.js into it -- maybe you can require it, if you've made a commonjs library, maybe you have to tell jsdom to load it like a script, or load and eval it yourself
test('test my library', function (t) {
t.ok(dom.stuff.mylibrary.whatever);
t.end();
})
Super minimal. I only add build tools when needed, and if libraries are small, you don't need very much.
Aria