Bug 1462055 - Fixup mocha test paths for webconsole;r=nchevobbe
authorBrian Grinstead <bgrinstead@mozilla.com>
Fri, 18 May 2018 11:33:18 -0700
changeset 418953 8347dbb954a9fd1e3808bc3dd47eef51df113368
parent 418952 e9f8e4d5aef7618e1b46fa99d154a6b978fe425d
child 418954 515249155baa5893a9dfc2d179ea37ee1255e4c2
push id34016
push userebalazs@mozilla.com
push dateSat, 19 May 2018 09:38:57 +0000
treeherdermozilla-central@94e22944d8ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1462055
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1462055 - Fixup mocha test paths for webconsole;r=nchevobbe MozReview-Commit-ID: LnkG8kA8eet
devtools/client/webconsole/components/JSTerm.js
devtools/client/webconsole/package.json
devtools/client/webconsole/test/components/new-console-output-wrapper.test.js
devtools/client/webconsole/test/helpers.js
devtools/client/webconsole/test/mocha-test-setup.js
devtools/client/webconsole/test/package.json
--- a/devtools/client/webconsole/components/JSTerm.js
+++ b/devtools/client/webconsole/components/JSTerm.js
@@ -1,28 +1,28 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
-const defer = require("devtools/shared/defer");
-const Debugger = require("Debugger");
 const Services = require("Services");
-const {KeyCodes} = require("devtools/client/shared/keycodes");
-const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 
 loader.lazyServiceGetter(this, "clipboardHelper",
                          "@mozilla.org/widget/clipboardhelper;1",
                          "nsIClipboardHelper");
+loader.lazyRequireGetter(this, "defer", "devtools/shared/defer");
+loader.lazyRequireGetter(this, "Debugger", "Debugger");
 loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 loader.lazyRequireGetter(this, "AutocompletePopup", "devtools/client/shared/autocomplete-popup");
 loader.lazyRequireGetter(this, "asyncStorage", "devtools/shared/async-storage");
+loader.lazyRequireGetter(this, "PropTypes", "devtools/client/shared/vendor/react-prop-types");
 loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
+loader.lazyRequireGetter(this, "KeyCodes", "devtools/client/shared/keycodes", true);
 
 const l10n = require("devtools/client/webconsole/webconsole-l10n");
 
 // Constants used for defining the direction of JSTerm input history navigation.
 const HISTORY_BACK = -1;
 const HISTORY_FORWARD = 1;
 
 const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers";
--- a/devtools/client/webconsole/package.json
+++ b/devtools/client/webconsole/package.json
@@ -10,17 +10,17 @@
   },
   "dependencies": {
     "babel-plugin-transform-flow-strip-types": "^6.22.0",
     "babel-plugin-transform-react-jsx": "^6.24.1",
     "babel-plugin-transform-object-rest-spread": "^6.26.0",
     "cross-env": "^3.1.3",
     "devtools-config": "0.0.12",
     "devtools-launchpad": "^0.0.119",
-    "devtools-modules": "0.0.35",
+    "devtools-modules": "0.0.37",
     "file-loader": "^1.1.6",
     "netmonitor": "file:../netmonitor",
     "raw-loader": "^0.5.1",
     "react": "=16.2.0",
     "react-dom": "=16.2.0",
     "react-prop-types": "=0.4.0",
     "react-redux": "=5.0.6",
     "redux": "^3.7.2",
--- a/devtools/client/webconsole/test/components/new-console-output-wrapper.test.js
+++ b/devtools/client/webconsole/test/components/new-console-output-wrapper.test.js
@@ -16,24 +16,27 @@ const {
 } = require("devtools/client/webconsole/test/helpers");
 
 const NewConsoleOutputWrapper =
   require("devtools/client/webconsole/new-console-output-wrapper");
 const { messagesAdd } =
   require("devtools/client/webconsole/actions/messages");
 
 function getNewConsoleOutputWrapper() {
-  const jsterm = {
-    hud: {
-      proxy: {
-        releaseActor: () => {}
-      }
-    }
+  const hud = {
+    proxy: {
+      releaseActor: () => {},
+      target: {
+        activeTab: {
+          ensureCSSErrorReportingEnabled: () => {}
+        }
+      },
+    },
   };
-  return new NewConsoleOutputWrapper(null, jsterm);
+  return new NewConsoleOutputWrapper(null, hud);
 }
 
 describe("NewConsoleOutputWrapper", () => {
   it("clears queues when dispatchMessagesClear is called", () => {
     const ncow = getNewConsoleOutputWrapper();
     ncow.queuedMessageAdds.push({fakePacket: "message"});
     ncow.queuedMessageUpdates.push({fakePacket: "message-update"});
     ncow.queuedRequestUpdates.push({fakePacket: "request-update"});
--- a/devtools/client/webconsole/test/helpers.js
+++ b/devtools/client/webconsole/test/helpers.js
@@ -37,18 +37,23 @@ function setupActions() {
 function setupStore(input = [], {
   storeOptions,
   actions,
   hud,
 } = {}) {
   if (!hud) {
     hud = {
       proxy: {
-        releaseActor: () => {}
-      }
+        releaseActor: () => {},
+        target: {
+          activeTab: {
+            ensureCSSErrorReportingEnabled: () => {}
+          }
+        },
+      },
     };
   }
   const store = configureStore(hud, storeOptions);
 
   // Add the messages from the input commands to the store.
   const messagesAdd = actions
     ? actions.messagesAdd
     : reduxActions.messagesAdd;
--- a/devtools/client/webconsole/test/mocha-test-setup.js
+++ b/devtools/client/webconsole/test/mocha-test-setup.js
@@ -21,16 +21,21 @@ pref("devtools.webconsole.filter.net", f
 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.autoMultiline", true);
 pref("devtools.webconsole.sidebarToggle", true);
 
+global.loader = {
+  lazyServiceGetter: () => {},
+  lazyRequireGetter: () => {}
+};
+
 // 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":
       return getModule("devtools/client/shared/vendor/react-dom");
     case "react-dom/server":
@@ -38,38 +43,44 @@ requireHacker.global_hook("default", (pa
     case "react-dom/test-utils":
       return getModule("devtools/client/shared/vendor/react-dom-test-utils-dev");
     case "react-redux":
       return getModule("devtools/client/shared/vendor/react-redux");
     // Use react-dev. This would be handled by browserLoader in Firefox.
     case "react":
     case "devtools/client/shared/vendor/react":
       return getModule("devtools/client/shared/vendor/react-dev");
+    case "chrome":
+      return `module.exports = { Cc: {}, Ci: {}, Cu: {} }`;
   }
 
   // Some modules depend on Chrome APIs which don't work in mocha. When such a module
   // is required, replace it with a mock version.
   switch (path) {
     case "devtools/shared/l10n":
       return getModule(
         "devtools/client/webconsole/test/fixtures/LocalizationHelper");
     case "devtools/shared/plural-form":
       return getModule(
         "devtools/client/webconsole/test/fixtures/PluralForm");
     case "Services":
     case "Services.default":
       return `module.exports = require("devtools-modules/src/Services")`;
     case "devtools/shared/client/object-client":
+    case "devtools/shared/client/long-string-client":
       return `() => {}`;
     case "devtools/client/netmonitor/src/components/TabboxPanel":
-      return "{}";
     case "devtools/client/webconsole/utils/context-menu":
       return "{}";
+    case "devtools/client/shared/telemetry":
+      return `module.exports = function() {}`;
     case "devtools/shared/event-emitter":
       return `module.exports = require("devtools-modules/src/utils/event-emitter")`;
+    case "devtools/client/shared/unicode-url":
+      return `module.exports = require("devtools-modules/src/unicode-url")`;
   }
 
   // We need to rewrite all the modules assuming the root is mozilla-central and give them
   // an absolute path.
   if (path.startsWith("devtools/")) {
     return getModule(path);
   }
 
--- a/devtools/client/webconsole/test/package.json
+++ b/devtools/client/webconsole/test/package.json
@@ -12,17 +12,17 @@
       " * We require jsdom-global to inject `document` and `window` objects which are",
       "   not in nodejs natively.",
       " * Finally we require mocha-test-setup where we configure Enzyme and",
       "   intercept require() calls with require-hacker and modify them if needed."
     ],
     "test": "mocha \"./{,@(components|middleware|store|utils)/**/}*.test.js\" -r mock-local-storage -r jsdom-global/register -r ./mocha-test-setup.js"
   },
   "dependencies": {
-    "devtools-modules": "0.0.31",
+    "devtools-modules": "0.0.37",
     "enzyme": "^3.3.0",
     "enzyme-adapter-react-16": "^1.1.1",
     "expect": "^1.16.0",
     "jsdom": "^9.4.1",
     "jsdom-global": "^2.0.0",
     "mocha": "^5.0.1",
     "mock-local-storage": "^1.0.5",
     "require-hacker": "^2.1.4",