Move test.js non-UI portions over to build.js