diff --git a/.babelrc b/.babelrc
index 9d60c831f..b0da20dd4 100644
--- a/.babelrc
+++ b/.babelrc
@@ -11,7 +11,8 @@
"resource/react-dom.js",
"resource/bluebird.js",
"test/resource/httpd.js",
- "test/resource/mocha.js"
+ "test/resource/mocha.js",
+ "test/resource/co-mocha.js"
],
"plugins": [
"syntax-flow",
diff --git a/package.json b/package.json
index 06e627ef8..819f34e36 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"browserify": "^14.3.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
+ "co-mocha": "^1.2.0",
"del": "^2.2.2",
"glob": "^7.1.2",
"gulp": "^3.9.1",
diff --git a/test/content/runtests.html b/test/content/runtests.html
index 7983c81e4..0df4ea6a0 100644
--- a/test/content/runtests.html
+++ b/test/content/runtests.html
@@ -9,6 +9,7 @@
+
diff --git a/test/content/runtests.js b/test/content/runtests.js
index ac642a986..ab06d519e 100644
--- a/test/content/runtests.js
+++ b/test/content/runtests.js
@@ -184,19 +184,7 @@ mocha.setup({
grep: ZoteroUnit.grep
});
-// Enable Bluebird generator support in Mocha
-(function () {
- var Runnable = Mocha.Runnable;
- var run = Runnable.prototype.run;
- Runnable.prototype.run = function (fn) {
- if (this.fn.constructor.name === 'GeneratorFunction') {
- this.fn = Zotero.Promise.coroutine(this.fn);
- } else if (typeof this.fn == 'function' && this.fn.isGenerator()) {
- throw new Error("Attempting to use a legacy generator in Mocha test");
- }
- return run.call(this, fn);
- };
-})();
+coMocha(Mocha);
before(function () {
// Store all prefs set in runtests.sh
diff --git a/test/resource/co-mocha.js b/test/resource/co-mocha.js
new file mode 120000
index 000000000..3351bc16f
--- /dev/null
+++ b/test/resource/co-mocha.js
@@ -0,0 +1 @@
+../../node_modules/co-mocha/co-mocha.js
\ No newline at end of file