我正在为一个 ember 项目编写一些测试,并且我正在寻找一种对某些测试进行分组的好方法,以便它们可以共享相同的设置/拆卸方法。
据我所知,可以通过以下方式完成:
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', ...);
但是,我认为很难确定哪个之前/之后适用于测试,而实际上没有将测试嵌套在moduleFor
其中,而 Ember 的自定义模块功能似乎不可能。
有人对我如何更干净地实施这个有任何建议吗?