test: more thorough tests for npm

I'm open to cleaning this up, but the basic idea is that the deps/npm installs its own `devDependencies`, runs both the legacy and tap tests against them, and cleans up after itself. It creates temporary directories to use as the cache and tmp directories (to avoid leaving detritus behind in any system / vm-wide caches), and removes them after a successful test run.

Right now, all the tests except the tests that spin up their own CouchDB instance are passing on my own machine. On a machine without Couch installed, these tests won't even be run, which means that they might just work out of the box.

Let me know if I need to rebase this change against a different branch.