mardi 5 janvier 2016

Nice way of making custom before/after for groups of tests

I'm writing some tests for an ember project, and I'm looking for a nice way to group certain tests so they can share the same setup/teardown methods.

From what I can tell, it can be done in this way:

moduleFor('adapter:application', 'Unit | Adapter | application', {});
test('Test using first moduleFor, which has no before/after', ...);

moduleFor('adapter:application', 'Unit | Adapter | application', {
  beforeEach() {...},
  afterEach() {...}
});
test('Test using new beforeEach/afterEach', ...);

However I'm thinking that it will be difficult to figure out which before/after applies to tests, without actually nesting the tests within the moduleFor which doesn't appear to be possible with Ember's custom module functions.

Does anybody have any suggestions on how I might implement this more cleanly?




Aucun commentaire:

Enregistrer un commentaire