mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1675769 - [devtools] Remove usage of devtools-environment isTesting. r=bomsy.
When possible, we switch to the plain devtools/shared/flags module. In some cases, the check was only done for jest test, so we use isNodeTest instead. Differential Revision: https://phabricator.services.mozilla.com/D96382
This commit is contained in:
parent
9725148bcb
commit
6e6be10526
@ -2194,7 +2194,7 @@
|
||||
"byName": {},
|
||||
"byBlocks": {},
|
||||
"usedIds": {
|
||||
"1": 1
|
||||
"0": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2215,7 +2215,7 @@
|
||||
"byName": {},
|
||||
"byBlocks": {},
|
||||
"usedIds": {
|
||||
"1": 1
|
||||
"0": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2236,7 +2236,7 @@
|
||||
"byName": {},
|
||||
"byBlocks": {},
|
||||
"usedIds": {
|
||||
"1": 1
|
||||
"0": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ const whatwgUrl = `
|
||||
module.exports = {
|
||||
"./source-editor": "devtools/client/sourceeditor/editor",
|
||||
"../editor/source-editor": "devtools/client/sourceeditor/editor",
|
||||
"./test-flag": "devtools/shared/flags",
|
||||
immutable: "devtools/client/shared/vendor/immutable",
|
||||
lodash: "devtools/client/shared/vendor/lodash",
|
||||
react: "devtools/client/shared/vendor/react",
|
||||
|
24
devtools/client/debugger/dist/search-worker.js
vendored
24
devtools/client/debugger/dist/search-worker.js
vendored
@ -4,14 +4,14 @@
|
||||
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("devtools/shared/flags"));
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["devtools/shared/flags"], factory);
|
||||
define([], factory);
|
||||
else {
|
||||
var a = typeof exports === 'object' ? factory(require("devtools/shared/flags")) : factory(root["devtools/shared/flags"]);
|
||||
var a = factory();
|
||||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
||||
}
|
||||
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_103__) {
|
||||
})(typeof self !== 'undefined' ? self : this, function() {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
@ -79,13 +79,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 103:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE_103__;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 560:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
@ -886,8 +879,6 @@ module.exports = arrayMap;
|
||||
/* WEBPACK VAR INJECTION */(function(process) {/* 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/>. */
|
||||
const flag = __webpack_require__(103);
|
||||
|
||||
function isNode() {
|
||||
return process && process.release && process.release.name == "node";
|
||||
}
|
||||
@ -896,14 +887,9 @@ function isNodeTest() {
|
||||
return isNode() && "production" != "production";
|
||||
}
|
||||
|
||||
function isTesting() {
|
||||
return flag.testing;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isNode,
|
||||
isNodeTest,
|
||||
isTesting
|
||||
isNodeTest
|
||||
};
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(607)))
|
||||
|
||||
|
24
devtools/client/debugger/dist/vendors.js
vendored
24
devtools/client/debugger/dist/vendors.js
vendored
@ -4,14 +4,14 @@
|
||||
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("devtools/shared/flags"), require("devtools/client/shared/vendor/react-dom"));
|
||||
module.exports = factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/react-dom"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["devtools/client/shared/vendor/react-prop-types", "devtools/client/shared/vendor/react-dom-factories", "devtools/client/shared/vendor/react", "devtools/shared/flags", "devtools/client/shared/vendor/react-dom"], factory);
|
||||
define(["devtools/client/shared/vendor/react-prop-types", "devtools/client/shared/vendor/react-dom-factories", "devtools/client/shared/vendor/react", "devtools/client/shared/vendor/react-dom"], factory);
|
||||
else {
|
||||
var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("devtools/shared/flags"), require("devtools/client/shared/vendor/react-dom")) : factory(root["devtools/client/shared/vendor/react-prop-types"], root["devtools/client/shared/vendor/react-dom-factories"], root["devtools/client/shared/vendor/react"], root["devtools/shared/flags"], root["devtools/client/shared/vendor/react-dom"]);
|
||||
var a = typeof exports === 'object' ? factory(require("devtools/client/shared/vendor/react-prop-types"), require("devtools/client/shared/vendor/react-dom-factories"), require("devtools/client/shared/vendor/react"), require("devtools/client/shared/vendor/react-dom")) : factory(root["devtools/client/shared/vendor/react-prop-types"], root["devtools/client/shared/vendor/react-dom-factories"], root["devtools/client/shared/vendor/react"], root["devtools/client/shared/vendor/react-dom"]);
|
||||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
||||
}
|
||||
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_103__, __WEBPACK_EXTERNAL_MODULE_112__) {
|
||||
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_112__) {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
@ -93,13 +93,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 103:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE_103__;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 112:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
@ -850,8 +843,6 @@ process.umask = function() { return 0; };
|
||||
/* WEBPACK VAR INJECTION */(function(process) {/* 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/>. */
|
||||
const flag = __webpack_require__(103);
|
||||
|
||||
function isNode() {
|
||||
return process && process.release && process.release.name == "node";
|
||||
}
|
||||
@ -860,14 +851,9 @@ function isNodeTest() {
|
||||
return isNode() && "production" != "production";
|
||||
}
|
||||
|
||||
function isTesting() {
|
||||
return flag.testing;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isNode,
|
||||
isNodeTest,
|
||||
isTesting
|
||||
isNodeTest
|
||||
};
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(607)))
|
||||
|
||||
|
@ -3,4 +3,3 @@
|
||||
- `isNode` - is the code running in a node environment (e.g. in a jest test, or when
|
||||
running a node script, like bin/bundle.js).
|
||||
- `isNodeTest` - is the code running in a node test environment (e.g. jest test).
|
||||
- `isTesting` - is the tool running in a mochitest environment
|
||||
|
@ -2,8 +2,6 @@
|
||||
* 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/>. */
|
||||
|
||||
const flag = require("./test-flag");
|
||||
|
||||
function isNode() {
|
||||
return process && process.release && process.release.name == "node";
|
||||
}
|
||||
@ -12,12 +10,7 @@ function isNodeTest() {
|
||||
return isNode() && process.env.NODE_ENV != "production";
|
||||
}
|
||||
|
||||
function isTesting() {
|
||||
return flag.testing;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isNode,
|
||||
isNodeTest,
|
||||
isTesting,
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ import { findBestMatchExpression } from "../utils/ast";
|
||||
import { getGrip, getFront } from "../utils/evaluation-result";
|
||||
import { getExpressionFromCoords } from "../utils/editor/get-expression";
|
||||
import { isOriginal } from "../utils/source";
|
||||
import { isTesting } from "devtools-environment";
|
||||
import { isNodeTest } from "devtools-environment";
|
||||
|
||||
import {
|
||||
getPreview,
|
||||
@ -150,7 +150,7 @@ export function setPreview(
|
||||
// The first time a popup is rendered, the mouse should be hovered
|
||||
// on the token. If it happens to be hovered on whitespace, it should
|
||||
// not render anything
|
||||
if (!target.matches(":hover") && !isTesting()) {
|
||||
if (!target.matches(":hover") && !isNodeTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
// @flow
|
||||
|
||||
import { isTesting } from "devtools-environment";
|
||||
// $FlowIgnore
|
||||
import flags from "devtools/shared/flags";
|
||||
import type { ThunkArgs } from "../../types";
|
||||
import { prefs } from "../../../utils/prefs";
|
||||
|
||||
@ -100,7 +101,7 @@ export function log({ dispatch, getState }: ThunkArgs) {
|
||||
const asyncMsg = !action.status ? "" : `[${action.status}]`;
|
||||
|
||||
if (prefs.logActions) {
|
||||
if (isTesting()) {
|
||||
if (flags.testing) {
|
||||
// $FlowIgnore
|
||||
dump(
|
||||
`[ACTION] ${action.type} ${asyncMsg} - ${serializeAction(action)}\n`
|
||||
|
@ -28,9 +28,6 @@ import {
|
||||
} from "../workers/search";
|
||||
import { clearDocuments } from "../utils/editor";
|
||||
|
||||
import env from "devtools-environment/test-flag";
|
||||
env.testing = true;
|
||||
|
||||
const rootPath = path.join(__dirname, "../../");
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
@ -10,7 +10,8 @@ import ReactDOM from "react-dom";
|
||||
const { Provider } = require("react-redux");
|
||||
|
||||
import ToolboxProvider from "devtools/client/framework/store-provider";
|
||||
import { isTesting } from "devtools-environment";
|
||||
// $FlowIgnore
|
||||
import flags from "devtools/shared/flags";
|
||||
|
||||
// $FlowIgnore
|
||||
const { AppConstants } = require("resource://gre/modules/AppConstants.jsm");
|
||||
@ -44,7 +45,7 @@ export function bootstrapStore(
|
||||
): any {
|
||||
const debugJsModules = AppConstants.DEBUG_JS_MODULES == "1";
|
||||
const createStore = configureStore({
|
||||
log: prefs.logging || isTesting(),
|
||||
log: prefs.logging || flags.testing,
|
||||
timing: debugJsModules,
|
||||
makeThunkArgs: (args, state) => {
|
||||
return { ...args, client, ...workers, panel };
|
||||
|
@ -11,7 +11,6 @@ const _path = require("path");
|
||||
const mappings = {
|
||||
"./source-editor": "devtools/client/shared/sourceeditor/editor",
|
||||
"../editor/source-editor": "devtools/client/shared/sourceeditor/editor",
|
||||
"./test-flag": "devtools/shared/flags",
|
||||
immutable: "devtools/client/shared/vendor/immutable",
|
||||
lodash: "devtools/client/shared/vendor/lodash",
|
||||
react: "devtools/client/shared/vendor/react",
|
||||
|
Loading…
Reference in New Issue
Block a user