REFACTOR: Use imports for `sinon` and `setResolver` (PR #10883)

I also took the opportunity with this commit to move some test specific stuff out of discourse-loader which is loaded on the front end of the application. The test module building now happens in the test_helper bundle.

GitHub

:rocket: