Bug 1468989 - Fix mocha tests; r=Honza. draft
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Fri, 15 Jun 2018 11:20:31 -0700
changeset 807776 b189f60dc7a51d7be541c563476fdf9a88cdc927
parent 807714 0b5495dc100dd3bfda0886a4ad563a3c729c9b72
child 807777 5206d1c7af81cd37dfed3d7f61cacfe01bb5e1df
push id113212
push userbmo:nchevobbe@mozilla.com
push dateFri, 15 Jun 2018 18:39:06 +0000
reviewersHonza
bugs1468989
milestone62.0a1
Bug 1468989 - Fix mocha tests; r=Honza. A fixture was needed for asyncStorage. MozReview-Commit-ID: CerVMppdhzk
devtools/client/webconsole/test/fixtures/async-storage.js
devtools/client/webconsole/test/mocha-test-setup.js
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/fixtures/async-storage.js
@@ -0,0 +1,13 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+module.exports = {
+  getItem: () => Promise.resolve(),
+  setItem: () => Promise.resolve(),
+  removeItem: () => Promise.resolve(),
+  clear: () => Promise.resolve(),
+  length: () => Promise.resolve(),
+  key: () => Promise.resolve(),
+};
--- a/devtools/client/webconsole/test/mocha-test-setup.js
+++ b/devtools/client/webconsole/test/mocha-test-setup.js
@@ -19,20 +19,25 @@ pref("devtools.webconsole.filter.debug",
 pref("devtools.webconsole.filter.css", false);
 pref("devtools.webconsole.filter.net", false);
 pref("devtools.webconsole.filter.netxhr", false);
 pref("devtools.webconsole.ui.filterbar", false);
 pref("devtools.webconsole.inputHistoryCount", 50);
 pref("devtools.webconsole.persistlog", false);
 pref("devtools.webconsole.timestampMessages", false);
 pref("devtools.webconsole.sidebarToggle", true);
+pref("devtools.webconsole.jsterm.codeMirror", false);
 
 global.loader = {
   lazyServiceGetter: () => {},
-  lazyRequireGetter: () => {}
+  lazyRequireGetter: (context, name, path) => {
+    if (path === "devtools/shared/async-storage") {
+      global[name] = require("devtools/client/webconsole/test/fixtures/async-storage");
+    }
+  }
 };
 
 // Point to vendored-in files and mocks when needed.
 const requireHacker = require("require-hacker");
 requireHacker.global_hook("default", (path, module) => {
   switch (path) {
     // For Enzyme
     case "react-dom":