REFACTOR: New format for acceptance tests (PR #10943)

This gets us closer to how newer Ember versions want to do things, but with a bit of Discourse flair.

acceptance now takes a function as a parameter, and tests need to be declared in that new function context.

A new helper, needs, is passed as a parameter. You can use it to set up the test the way you want.


Would it be possible to export those helper functions instead? That would more closely align our tests suite with the latest qunit/ember testing idioms (for example: setupApplicationTest or setupMirage)

Ember doesn’t exactly do that. You get a hooks object from module which is the qunit context. That’s then passed on like setupApplicationTest(hooks).

If you want to add a beforeEach/afterEach you need to call it on the hooks object,

hooks.beforeEach(() => my code)

And that’s the pattern I stuck with, because the context object you are passed (needs) is the context of the test itself, not a helper that uses that object to set up the test. Does that make sense?