Bug 1451378 - Enable ESLint rule no-undef for more test files in devtools. r=jdescottes

MozReview-Commit-ID: 6q43u1m0hLI

--HG--
extra : rebase_source : 02bf20a95994ac2fb13e3a69e3d504564fcc279d
This commit is contained in:
Mark Banner 2018-04-04 16:56:30 +01:00
Родитель b7a889c98b
Коммит 57f0cf24f4
25 изменённых файлов: 34 добавлений и 37 удалений

Просмотреть файл

@ -16,12 +16,8 @@ module.exports = {
// XXX Bug 1230193. We're still working on enabling no-undef for these test
// directories.
"files": [
"client/memory/test/**",
"server/tests/browser/**",
"server/tests/mochitest/**",
"shared/heapsnapshot/tests/unit/**",
"shared/tests/unit/**",
"shared/webconsole/test/**",
],
"rules": {
"no-undef": "off",

Просмотреть файл

@ -3,14 +3,6 @@
module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js",
"globals": {
"addTab": true,
"censusState": true,
"refreshTab": true,
"removeTab": true,
"waitForTime": true,
"waitUntilState": true
},
"rules": {
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
}

Просмотреть файл

@ -7,7 +7,7 @@
*/
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
const { viewState, censusState } = require("devtools/client/memory/constants");
const { viewState } = require("devtools/client/memory/constants");
const { changeView } = require("devtools/client/memory/actions/view");
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {

Просмотреть файл

@ -8,7 +8,6 @@
const {
dominatorTreeState,
viewState,
censusState,
} = require("devtools/client/memory/constants");
const { changeViewAndRefresh, changeView } = require("devtools/client/memory/actions/view");

Просмотреть файл

@ -9,7 +9,6 @@
const {
individualsState,
viewState,
censusState,
} = require("devtools/client/memory/constants");
const { changeView } = require("devtools/client/memory/actions/view");

Просмотреть файл

@ -6,8 +6,7 @@
"use strict";
const {
viewState,
censusState
viewState
} = require("devtools/client/memory/constants");
const {
takeSnapshotAndCensus

Просмотреть файл

@ -7,7 +7,6 @@
"use strict";
const {
censusState,
viewState
} = require("devtools/client/memory/constants");
const {

Просмотреть файл

@ -8,7 +8,7 @@
*/
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
const { viewState, censusState } = require("devtools/client/memory/constants");
const { viewState } = require("devtools/client/memory/constants");
const { changeView } = require("devtools/client/memory/actions/view");
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {

Просмотреть файл

@ -4,16 +4,18 @@
"use strict";
// Load the shared test helpers into this compartment.
/* import-globals-from ../../../shared/test/shared-head.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
this);
// Load the shared Redux helpers into this compartment.
/* import-globals-from ../../../shared/test/shared-redux-head.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-redux-head.js",
this);
var { censusDisplays, snapshotState: states } = require("devtools/client/memory/constants");
var { censusDisplays, censusState, snapshotState: states } = require("devtools/client/memory/constants");
var { L10N } = require("devtools/client/memory/utils");
Services.prefs.setBoolPref("devtools.memory.enabled", true);

Просмотреть файл

@ -3,11 +3,6 @@
module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../.eslintrc.mochitests.js",
"globals": {
"SimpleTest": true,
"ok": true,
"requestAnimationFrame": true
},
"rules": {
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
}

Просмотреть файл

@ -6,7 +6,6 @@ module.exports = {
"rules": {
"no-unused-vars": ["error", {
"vars": "local",
"varsIgnorePattern": "^run_test$"
}]
}
};

Просмотреть файл

@ -3,6 +3,9 @@
"use strict";
// via xpcshell.ini
/* import-globals-from ../../../shared/test/shared-redux-head.js */
var { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
var Services = require("Services");

Просмотреть файл

@ -2,5 +2,5 @@
module.exports = {
// Extend from the common devtools mochitest eslintrc config.
"extends": "../../../.eslintrc.xpcshell.js"
"extends": "../../../.eslintrc.mochitests.js"
};

Просмотреть файл

@ -26,12 +26,11 @@ async function test() {
let { errorActor } = await gClient.listTabs();
ok(errorActor, "Found the error actor.");
try {
await gClient.request({ to: globalActor, type: "error" });
ok(false, "The request is expected to fail.");
} catch (e) {
ok(true, "The request failed as expected, and was caught by the client");
}
await Assert.rejects(gClient.request({ to: errorActor, type: "error" }),
err => err.error == "unknownError" &&
/error occurred while processing 'error/.test(err.message),
"The request should be rejected");
await gClient.close();
finish();

Просмотреть файл

@ -8,6 +8,7 @@
// name (and different paths).
const {StorageFront} = require("devtools/shared/fronts/storage");
/* import-globals-from storage-helpers.js */
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
const TESTDATA = {

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const { StorageFront } = require("devtools/shared/fronts/storage");
/* import-globals-from storage-helpers.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js",
this);

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const {StorageFront} = require("devtools/shared/fronts/storage");
/* import-globals-from storage-helpers.js */
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
const storeMap = {

Просмотреть файл

@ -12,6 +12,7 @@
<script type="text/javascript">
"use strict";
/* global test */
window.test = function() {
document.body.expando1 = { cycle: document.body };
SpecialPowers.Cu.forceCC();

Просмотреть файл

@ -13,6 +13,7 @@
"use strict";
var x = 1;
/* global test */
window.test = function() {
SpecialPowers.Cu.forceGC();
document.body.style.borderTop = x + "px solid red";

Просмотреть файл

@ -5,6 +5,8 @@
"use strict";
/* global DebuggerServer */
/**
* Test actor designed to check that clients are properly notified of errors when calling
* methods on old style actors.

Просмотреть файл

@ -1,6 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// This file assumes head.js is loaded in the global scope.
/* import-globals-from head.js */
/* exported openTabAndSetupStorage, clearStorage */
"use strict";

Просмотреть файл

@ -111,7 +111,7 @@ function getFilePath(name, allowMissing = false, usePlatformPathSeparator = fals
path = path.slice(filePrePath.length);
if (sePlatformPathSeparator && path.match(/^\w:/)) {
if (usePlatformPathSeparator && path.match(/^\w:/)) {
path = path.replace(/\//g, "\\");
}
@ -335,7 +335,7 @@ function assertLabelAndShallowSize(breakdown, givenDescription,
dumpn("Given description: " + JSON.stringify(givenDescription, null, 4));
const visitor = new LabelAndShallowSizeVisitor();
CensusUtils.walk(breakdown, description, visitor);
CensusUtils.walk(breakdown, givenDescription, visitor);
dumpn("Expected shallow size: " + expectedShallowSize);
dumpn("Actual shallow size: " + visitor.shallowSize());
@ -435,7 +435,7 @@ function assertDeduplicatedPaths({ target, paths, expectedNodes, expectedEdges }
}
equal(count, 1,
"should have exactly one matching edge for the expected edge = "
+ JSON.stringify(edge));
+ JSON.stringify(expectedEdge));
}
}

Просмотреть файл

@ -24,6 +24,7 @@ module.exports = {
"DOMRequest": false,
"Debugger": false,
"DedicatedWorkerGlobalScope": false,
"DominatorTree": false,
"HeapSnapshot": false,
"IDBFileRequest": false,
"IDBLocaleAwareKeyRange": false,
@ -55,6 +56,7 @@ module.exports = {
"console": true,
"dump": true,
"openDialog": false,
"saveStack": false,
"sizeToContent": false,
// Specific to Firefox
// eslint-disable-next-line max-len

Просмотреть файл

@ -9,6 +9,9 @@ module.exports = {
"_TEST_FILE": false,
"add_task": false,
"add_test": false,
// Test-only function.
"allocationMarker": false,
"byteSize": false,
"deepEqual": false,
"do_await_remote_message": false,
"do_check_instanceof": false,
@ -29,6 +32,7 @@ module.exports = {
"do_timeout": false,
"equal": false,
"executeSoon": false,
"gc": false,
// XPCShell specific function, see XPCShellEnvironment.cpp
"gczeal": false,
"greater": false,

Просмотреть файл

@ -35,7 +35,6 @@ module.exports = {
"DOMException": false,
"DOMRequest": false,
"DOMStringList": false,
"DominatorTree": false,
"ErrorEvent": false,
"Event": false,
"EventTarget": false,