Move test loader to testinit.js. Fix race condition with dependency loading.