<NME> mocha-module.js
<BEF> ADDFILE
<MSG> Extract createModule into separate function

<DFF> @@ -0,0 +1,29 @@
+export function createModule(Constructor, name, description, callbacks, tests) {
+  var module;
+
+  if (!tests) {
+    if (!callbacks) {
+      tests = description;
+      callbacks = {};
+    } else {
+      tests = callbacks;
+      callbacks = description;
+    }
+    module = new Constructor(name, callbacks);
+
+  } else {
+    module = new Constructor(name, description, callbacks);
+  }
+
+  describe(module.name, function() {
+    beforeEach(function() {
+      module.setup();
+    });
+
+    afterEach(function() {
+      module.teardown();
+    });
+
+    tests();
+  });
+}

Extract createModule into separate function