We could use the factory pattern, see it in https://github.com/evanxd/gaia/blob/1cf8049438270594d50d39a3325bce1a630706c4/apps/calendar/test/marionette/lib/server_helper.js#L8-L13.