diff --git a/karma.conf.js b/karma.conf.js
index 4ad72b4927..d544248332 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -177,6 +177,11 @@ module.exports = function (config) {
                 ],
             },
             devtool: 'inline-source-map',
+            externals: {
+                // Don't try to bundle electron: leave it as a commonjs dependency
+                // (the 'commonjs' here means it will output a 'require')
+                "electron": "commonjs electron",
+            },
         },
 
         webpackMiddleware: {