Factor out a test sandbox module

This hides most of the nastiness inside a test helper module.

We're using vm.runInNewContext() now, which is exactly what smash does under the hood for d3.