[BUGFIX beta] Allow test helpers to be injected on specific object.

This allows the test helpers to be injected into an object other than
`window`.
Merge pull request #3686 from rjackson/refactor_testing

[BUGFIX beta] Allow test helpers to be injected on specific object.