ember-qunit-codemod
ember-qunit-codemod copied to clipboard
Handle "options generator" functions for moduleFor*
Input:
moduleFor('service:foo', callSomeMethod());
test('stuff here', function(assert) {
// ...snip...
});
Suggested output:
import { module } from 'qunit';
import { setupTest } from 'ember-qunit';
let options = callSomeMethod();
module('service:foo', function(hooks) {
setupTest(hooks);
options.before && hooks.before(options.before);
options.beforeEach && hooks.beforeEach(options.beforeEach);
options.afterEach && hooks.afterEach(options.afterEach);
options.after && hooks.after(options.after);
});
test('stuff here', function(assert) {
// ...snip...
});
I'd prefer real if conditions
Ya, definitely fine with me also.