github.com/DerekStrickland/consul@v1.4.5/ui-v2/tests/helpers/module-for-acceptance.js (about) 1 import { module } from 'qunit'; 2 import { resolve } from 'rsvp'; 3 import startApp from '../helpers/start-app'; 4 import destroyApp from '../helpers/destroy-app'; 5 6 export default function(name, options = {}) { 7 module(name, { 8 beforeEach() { 9 this.application = startApp(); 10 11 if (options.beforeEach) { 12 return options.beforeEach.apply(this, arguments); 13 } 14 }, 15 16 afterEach() { 17 let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 18 return resolve(afterEach).then(() => destroyApp(this.application)); 19 }, 20 }); 21 }