Bug 1375678 - Enable lint on testing/modules - mechanical changes; r=standard8
authorGeoff Brown <gbrown@mozilla.com>
Fri, 23 Jun 2017 15:08:02 -0600
changeset 414745 edbec3a0e1a7b77f0331a8ff40915b8dad4cf746
parent 414744 aac24c1fa355a528f96bd234b04b31f33b7cebb0
child 414746 ac4370aa1b189e618fd03d5abea4a93b6f916a36
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1375678
milestone56.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 1375678 - Enable lint on testing/modules - mechanical changes; r=standard8
.eslintignore
testing/modules/AppData.jsm
testing/modules/AppInfo.jsm
testing/modules/Assert.jsm
testing/modules/CoverageUtils.jsm
testing/modules/MockRegistrar.jsm
testing/modules/MockRegistry.jsm
testing/modules/StructuredLog.jsm
testing/modules/tests/browser/.eslintrc.js
testing/modules/tests/xpcshell/.eslintrc.js
testing/modules/tests/xpcshell/test_assert.js
testing/modules/tests/xpcshell/test_mockRegistrar.js
testing/modules/tests/xpcshell/test_structuredlog.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -295,17 +295,19 @@ security/nss/**
 
 # Uses `#filter substitution`
 services/sync/modules/constants.js
 services/sync/services-sync.js
 
 # testing/ exclusions
 testing/marionette/**
 testing/mochitest/**
-testing/modules/**
+# third party modules
+testing/modules/ajv-4.1.1.js
+testing/modules/sinon-2.3.2.js
 # octothorpe used for pref file comment causes parsing error
 testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
 testing/talos/**
 testing/web-platform/**
 testing/xpcshell/moz-http2/**
 testing/xpcshell/node-http2/**
 
 # Third party services
--- a/testing/modules/AppData.jsm
+++ b/testing/modules/AppData.jsm
@@ -24,17 +24,17 @@ var gFakeAppDirectoryProvider;
  *
  * We create the new UAppData directory under the profile's directory
  * because the profile directory is automatically cleaned as part of
  * test shutdown.
  *
  * This returns a promise that will be resolved once the new directory
  * is created and installed.
  */
-this.makeFakeAppDir = function () {
+this.makeFakeAppDir = function() {
   let dirMode = OS.Constants.libc.S_IRWXU;
   let dirService = Cc["@mozilla.org/file/directory_service;1"]
                      .getService(Ci.nsIProperties);
   let baseFile = dirService.get("ProfD", Ci.nsIFile);
   let appD = baseFile.clone();
   appD.append("UAppData");
 
   if (gFakeAppDirectoryProvider) {
@@ -60,42 +60,42 @@ this.makeFakeAppDir = function () {
   let submittedD = reportsD.clone();
   submittedD.append("submitted");
 
   makeDir(reportsD);
   makeDir(pendingD);
   makeDir(submittedD);
 
   let provider = {
-    getFile: function (prop, persistent) {
+    getFile(prop, persistent) {
       persistent.value = true;
       if (prop == "UAppData") {
         return appD.clone();
       }
 
       throw Cr.NS_ERROR_FAILURE;
     },
 
-    QueryInterace: function (iid) {
+    QueryInterace(iid) {
       if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
           iid.equals(Ci.nsISupports)) {
         return this;
       }
 
       throw Cr.NS_ERROR_NO_INTERFACE;
     },
   };
 
   // Register the new provider.
   dirService.QueryInterface(Ci.nsIDirectoryService)
             .registerProvider(provider);
 
   // And undefine the old one.
   try {
     dirService.undefine("UAppData");
-  } catch (ex) {};
+  } catch (ex) {}
 
   gFakeAppDirectoryProvider = provider;
 
   dump("Successfully installed fake UAppDir\n");
   return Promise.resolve(appD.path);
 };
 
--- a/testing/modules/AppInfo.jsm
+++ b/testing/modules/AppInfo.jsm
@@ -26,41 +26,41 @@ let origPlatformInfo = Cc["@mozilla.org/
  *   name:            nsIXULAppInfo.name
  *   version:         nsIXULAppInfo.version
  *   platformVersion: nsIXULAppInfo.platformVersion
  *   OS:              nsIXULRuntime.OS
  *
  *   crashReporter:   nsICrashReporter interface is implemented if true
  *   extraProps:      extra properties added to XULAppInfo
  */
-this.newAppInfo = function (options={}) {
+this.newAppInfo = function(options = {}) {
   let ID = ("ID" in options) ? options.ID : "xpcshell@tests.mozilla.org";
   let name = ("name" in options) ? options.name : "xpcshell";
   let version = ("version" in options) ? options.version : "1";
   let platformVersion
       = ("platformVersion" in options) ? options.platformVersion : "p-ver";
   let OS = ("OS" in options) ? options.OS : "XPCShell";
   let extraProps = ("extraProps" in options) ? options.extraProps : {};
 
   let appInfo = {
     // nsIXULAppInfo
     vendor: "Mozilla",
-    name: name,
-    ID: ID,
-    version: version,
+    name,
+    ID,
+    version,
     appBuildID: "20160315",
 
     // nsIPlatformInfo
-    platformVersion: platformVersion,
+    platformVersion,
     platformBuildID: origPlatformInfo.platformBuildID,
 
     // nsIXULRuntime
     inSafeMode: false,
     logConsoleErrors: true,
-    OS: OS,
+    OS,
     XPCOMABI: "noarch-spidermonkey",
     invalidateCachesOnRestart() {},
 
     // nsIWinAppHelper
     get userCanElevate() {
       return false;
     },
   };
@@ -90,41 +90,41 @@ this.newAppInfo = function (options={}) 
   return appInfo;
 };
 
 var currentAppInfo = newAppInfo();
 
 /**
  * Obtain a reference to the current object used to define XULAppInfo.
  */
-this.getAppInfo = function () { return currentAppInfo; };
+this.getAppInfo = function() { return currentAppInfo; };
 
 /**
  * Update the current application info.
  *
  * See newAppInfo for options.
  *
  * To change the current XULAppInfo, simply call this function. If there was
  * a previously registered app info object, it will be unloaded and replaced.
  */
-this.updateAppInfo = function (options) {
+this.updateAppInfo = function(options) {
   currentAppInfo = newAppInfo(options);
 
   let id = Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}");
   let cid = "@mozilla.org/xre/app-info;1";
   let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
 
   // Unregister an existing factory if one exists.
   try {
     let existing = Components.manager.getClassObjectByContractID(cid, Ci.nsIFactory);
     registrar.unregisterFactory(id, existing);
   } catch (ex) {}
 
   let factory = {
-    createInstance: function (outer, iid) {
+    createInstance(outer, iid) {
       if (outer != null) {
         throw Cr.NS_ERROR_NO_AGGREGATION;
       }
 
       return currentAppInfo.QueryInterface(iid);
     },
   };
 
--- a/testing/modules/Assert.jsm
+++ b/testing/modules/Assert.jsm
@@ -51,19 +51,19 @@ function replacer(key, value) {
   return value;
 }
 
 const kTruncateLength = 128;
 
 function truncate(text, newLength = kTruncateLength) {
   if (typeof text == "string") {
     return text.length < newLength ? text : text.slice(0, newLength);
-  } else {
+  }
     return text;
-  }
+
 }
 
 function getMessage(error, prefix = "") {
   let actual, expected;
   // Wrap calls to JSON.stringify in try...catch blocks, as they may throw. If
   // so, fall back to toString().
   try {
     actual = JSON.stringify(error.actual, replacer);
@@ -104,17 +104,17 @@ Assert.AssertionError = function(options
   this.actual = options.actual;
   this.expected = options.expected;
   this.operator = options.operator;
   this.message = getMessage(this, options.message);
   // The part of the stack that comes from this module is not interesting.
   let stack = Components.stack;
   do {
     stack = stack.asyncCaller || stack.caller;
-  } while(stack && stack.filename && stack.filename.includes("Assert.jsm"))
+  } while (stack && stack.filename && stack.filename.includes("Assert.jsm"))
   this.stack = stack;
 };
 
 // assert.AssertionError instanceof Error
 Assert.AssertionError.prototype = Object.create(Error.prototype, {
   constructor: {
     value: Assert.AssertionError,
     enumerable: false,
@@ -176,20 +176,20 @@ proto.setReporter = function(reporterFun
  *        (mixed) Expected result from the test author
  * @param message (optional)
  *        (string) Short explanation of the expected result
  * @param operator (optional)
  *        (string) Operation qualifier used by the assertion method (ex: '==')
  */
 proto.report = function(failed, actual, expected, message, operator) {
   let err = new Assert.AssertionError({
-    message: message,
-    actual: actual,
-    expected: expected,
-    operator: operator
+    message,
+    actual,
+    expected,
+    operator
   });
   if (!this._reporter) {
     // If no custom reporter is set, throw the error.
     if (failed) {
       throw err;
     }
   } else {
     this._reporter(failed ? err : null, err.message, err.stack);
--- a/testing/modules/CoverageUtils.jsm
+++ b/testing/modules/CoverageUtils.jsm
@@ -14,17 +14,17 @@ const Cu = Components.utils;
 
 const {addDebuggerToGlobal} = Cu.import("resource://gre/modules/jsdebugger.jsm",
                                         {});
 addDebuggerToGlobal(this);
 
 /**
  * Records coverage for each test by way of the js debugger.
  */
-this.CoverageCollector = function (prefix) {
+this.CoverageCollector = function(prefix) {
   this._prefix = prefix;
   this._dbg = new Debugger();
   this._dbg.collectCoverageInfo = true;
   this._dbg.addAllGlobalsAsDebuggees();
   this._scripts = this._dbg.findScripts();
 
   this._dbg.onNewScript = (script) => {
     this._scripts.push(script);
@@ -32,17 +32,17 @@ this.CoverageCollector = function (prefi
 
   // Source -> coverage data;
   this._allCoverage = {};
   this._encoder = new TextEncoder();
 
   this._testIndex = 0;
 }
 
-CoverageCollector.prototype._getLinesCovered = function () {
+CoverageCollector.prototype._getLinesCovered = function() {
   let coveredLines = {};
   let currentCoverage = {};
   this._scripts.forEach(s => {
     let scriptName = s.url;
     let cov = s.getOffsetsCoverage();
     if (!cov) {
       return;
     }
@@ -55,17 +55,17 @@ CoverageCollector.prototype._getLinesCov
 
       if (!currentCoverage[scriptName]) {
         currentCoverage[scriptName] = {};
       }
       if (!this._allCoverage[scriptName]) {
         this._allCoverage[scriptName] = {};
       }
 
-      let key = [lineNumber, columnNumber, offset].join('#');
+      let key = [lineNumber, columnNumber, offset].join("#");
       if (!currentCoverage[scriptName][key]) {
         currentCoverage[scriptName][key] = count;
       } else {
         currentCoverage[scriptName][key] += count;
       }
     });
 
   });
@@ -75,17 +75,17 @@ CoverageCollector.prototype._getLinesCov
   // offset in a line is novel as of this test, or a count has increased for
   // any offset on a particular line, that line must have been covered.
   for (let scriptName in currentCoverage) {
     for (let key in currentCoverage[scriptName]) {
       if (!this._allCoverage[scriptName] ||
           !this._allCoverage[scriptName][key] ||
           (this._allCoverage[scriptName][key] <
            currentCoverage[scriptName][key])) {
-        let [lineNumber, colNumber, offset] = key.split('#');
+        let [lineNumber, colNumber, offset] = key.split("#");
         if (!coveredLines[scriptName]) {
           coveredLines[scriptName] = new Set();
         }
         coveredLines[scriptName].add(parseInt(lineNumber, 10));
         this._allCoverage[scriptName][key] = currentCoverage[scriptName][key];
       }
     }
   }
@@ -110,17 +110,17 @@ CoverageCollector.prototype._getUncovere
       }
       uncoveredLines[scriptName].add(index);
     });
   });
 
   // For all covered lines, delete their entry
   for (let scriptName in this._allCoverage) {
     for (let key in this._allCoverage[scriptName]) {
-      let [lineNumber, columnNumber, offset] = key.split('#');
+      let [lineNumber, columnNumber, offset] = key.split("#");
       uncoveredLines[scriptName].delete(parseInt(lineNumber, 10));
     }
   }
 
   return uncoveredLines;
 }
 
 CoverageCollector.prototype._getMethodNames = function() {
@@ -140,17 +140,17 @@ CoverageCollector.prototype._getMethodNa
       methodNames[scriptName] = {};
     }
 
     /**
     * Get all lines contained within the method and
     * push a record of the form:
     * <method name> : <lines covered>
     */
-    scriptOffsets.forEach( function (element, index) {
+    scriptOffsets.forEach( function(element, index) {
       if (!element) {
         return;
       }
       tempMethodCov.push(index);
     });
     methodNames[scriptName][method] = tempMethodCov;
   });
 
@@ -169,17 +169,17 @@ Object.prototype[Symbol.iterator] = func
 };
 
 
 /**
  * Records lines covered since the last time coverage was recorded,
  * associating them with the given test name. The result is written
  * to a json file in a specified directory.
  */
-CoverageCollector.prototype.recordTestCoverage = function (testName) {
+CoverageCollector.prototype.recordTestCoverage = function(testName) {
   let ccov_scope = {};
   const {OS} = Cu.import("resource://gre/modules/osfile.jsm", ccov_scope);
 
   dump("Collecting coverage for: " + testName + "\n");
   let rawLines = this._getLinesCovered(testName);
   let methods = this._getMethodNames();
   let uncoveredLines = this._getUncoveredLines();
   let result = [];
@@ -190,37 +190,37 @@ CoverageCollector.prototype.recordTestCo
     let rec = {
       testUrl: testName,
       sourceFile: scriptName,
       methods: {},
       covered: [],
       uncovered: []
     };
 
-    if (typeof(methods[scriptName]) != 'undefined' && methods[scriptName] != null) {
+    if (typeof(methods[scriptName]) != "undefined" && methods[scriptName] != null) {
       for (let [methodName, methodLines] of methods[scriptName]) {
         rec.methods[methodName] = methodLines;
       }
     }
 
     for (let line of rawLines[scriptName]) {
       rec.covered.push(line);
     }
 
     for (let line of uncoveredLines[scriptName]) {
       rec.uncovered.push(line);
     }
 
     result.push(rec);
   }
   let arr = this._encoder.encode(JSON.stringify(result, null, 2));
-  let path = this._prefix + '/' + 'jscov_' + Date.now() + '.json';
+  let path = this._prefix + "/" + "jscov_" + Date.now() + ".json";
   dump("Writing coverage to: " + path + "\n");
-  return OS.File.writeAtomic(path, arr, {tmpPath: path + '.tmp'});
+  return OS.File.writeAtomic(path, arr, {tmpPath: path + ".tmp"});
 }
 
 /**
  * Tear down the debugger after all tests are complete.
  */
-CoverageCollector.prototype.finalize = function () {
+CoverageCollector.prototype.finalize = function() {
   this._dbg.removeAllDebuggees();
   this._dbg.enabled = false;
 }
--- a/testing/modules/MockRegistrar.jsm
+++ b/testing/modules/MockRegistrar.jsm
@@ -57,17 +57,17 @@ this.MockRegistrar = Object.freeze({
           mock.apply(wrappedMock, args);
         } else {
           wrappedMock = mock;
         }
 
         try {
           let genuine = originalFactory.createInstance(outer, iid);
           wrappedMock._genuine = genuine;
-        } catch(ex) {
+        } catch (ex) {
           logger.info("Creating original instance failed", ex);
         }
 
         return wrappedMock.QueryInterface(iid);
       },
       lockFactory(lock) {
         throw Cr.NS_ERROR_NOT_IMPLEMENTED;
       },
@@ -76,19 +76,19 @@ this.MockRegistrar = Object.freeze({
 
     this.registrar.unregisterFactory(originalCID, originalFactory);
     this.registrar.registerFactory(originalCID,
                                    "A Mock for " + contractID,
                                    contractID,
                                    factory);
 
     this._registeredComponents.set(originalCID, {
-      contractID: contractID,
-      factory: factory,
-      originalFactory: originalFactory
+      contractID,
+      factory,
+      originalFactory
     });
 
     return originalCID;
   },
 
   /**
    * Unregister the mock.
    *
--- a/testing/modules/MockRegistry.jsm
+++ b/testing/modules/MockRegistry.jsm
@@ -33,53 +33,53 @@ class MockRegistry {
     function MockWindowsRegKey() { }
     MockWindowsRegKey.prototype = {
       values: null,
 
       // --- Overridden nsISupports interface functions ---
       QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowsRegKey]),
 
       // --- Overridden nsIWindowsRegKey interface functions ---
-      open: function(root, path, mode) {
+      open(root, path, mode) {
         let rootKey = registry.getRoot(root);
         if (!rootKey.has(path)) {
           rootKey.set(path, new Map());
         }
         this.values = rootKey.get(path);
       },
 
-      close: function() {
+      close() {
         this.values = null;
       },
 
       get valueCount() {
         if (!this.values)
           throw Components.results.NS_ERROR_FAILURE;
         return this.values.size;
       },
 
-      hasValue: function(name) {
+      hasValue(name) {
         if (!this.values) {
           return false;
         }
         return this.values.has(name);
       },
 
-      getValueType: function(name) {
+      getValueType(name) {
         return Ci.nsIWindowsRegKey.TYPE_STRING;
       },
 
-      getValueName: function(index) {
+      getValueName(index) {
         if (!this.values || index >= this.values.size)
           throw Components.results.NS_ERROR_FAILURE;
 	let names = Array.from(this.values.keys());
         return names[index];
       },
 
-      readStringValue: function(name) {
+      readStringValue(name) {
         if (!this.values) {
           throw new Error("invalid registry path");
         }
         return this.values.get(name);
       }
     };
 
     this.cid = MockRegistrar.register("@mozilla.org/windows-registry-key;1", MockWindowsRegKey);
@@ -106,10 +106,10 @@ class MockRegistry {
 
     let pathmap = rootKey.get(path);
     if (value == null) {
       pathmap.delete(name);
     } else {
       pathmap.set(name, value);
     }
   }
-};
+}
 
--- a/testing/modules/StructuredLog.jsm
+++ b/testing/modules/StructuredLog.jsm
@@ -18,43 +18,43 @@ this.EXPORTED_SYMBOLS = [
  * @param dumpFun
  *        An underlying function to be used to log raw messages. This function
  *        will receive the complete serialized json string to log.
  * @param mutators
  *        An array of functions used to add global context to log messages.
  *        These will each be called with the complete object to log as an
  *        argument.
  */
-this.StructuredLogger = function(name, dumpFun=dump, mutators=[]) {
+this.StructuredLogger = function(name, dumpFun = dump, mutators = []) {
   this.name = name;
   this._dumpFun = dumpFun;
   this._mutatorFuns = mutators;
 }
 
 /**
  * Log functions producing messages in the format specified by mozlog
  */
 StructuredLogger.prototype = {
-  testStart: function (test) {
+  testStart(test) {
     var data = {test: this._testId(test)};
     this._logData("test_start", data);
   },
 
-  testStatus: function (test, subtest, status, expected="PASS",
-                        message=null, stack=null, extra=null) {
+  testStatus(test, subtest, status, expected = "PASS",
+                        message = null, stack = null, extra = null) {
 
     if (subtest === null || subtest === undefined) {
       // Fix for assertions that don't pass in a name
       subtest = "undefined assertion name";
     }
 
     var data = {
       test: this._testId(test),
-      subtest: subtest,
-      status: status,
+      subtest,
+      status,
     };
 
     if (expected != status && status != "SKIP") {
       data.expected = expected;
     }
     if (message !== null) {
       data.message = String(message);
     }
@@ -63,18 +63,18 @@ StructuredLogger.prototype = {
     }
     if (extra !== null) {
       data.extra = extra;
     }
 
     this._logData("test_status", data);
   },
 
-  testEnd: function (test, status, expected="OK", message=null, stack=null, extra=null) {
-    var data = {test: this._testId(test), status: status};
+  testEnd(test, status, expected = "OK", message = null, stack = null, extra = null) {
+    var data = {test: this._testId(test), status};
 
     if (expected != status && status != "SKIP") {
       data.expected = expected;
     }
     if (message !== null) {
       data.message = String(message);
     }
     if (stack !== null) {
@@ -82,26 +82,26 @@ StructuredLogger.prototype = {
     }
     if (extra !== null) {
       data.extra = extra;
     }
 
     this._logData("test_end", data);
   },
 
-  assertionCount: function (test, count, minExpected=0, maxExpected=0) {
-      var data = {test: test,
+  assertionCount(test, count, minExpected = 0, maxExpected = 0) {
+      var data = {test,
                   min_expected: minExpected,
                   max_expected: maxExpected,
-                  count: count};
+                  count};
 
     this._logData("assertion_count", data);
   },
 
-  suiteStart: function (tests, runinfo=null, versioninfo=null, deviceinfo=null, extra=null) {
+  suiteStart(tests, runinfo = null, versioninfo = null, deviceinfo = null, extra = null) {
     var data = {tests: tests.map(x => this._testId(x))};
     if (runinfo !== null) {
       data.runinfo = runinfo;
     }
 
     if (versioninfo !== null) {
       data.versioninfo = versioninfo;
     }
@@ -112,79 +112,79 @@ StructuredLogger.prototype = {
 
     if (extra !== null) {
       data.extra = extra;
     }
 
     this._logData("suite_start", data);
   },
 
-  suiteEnd: function (extra=null) {
+  suiteEnd(extra = null) {
     var data = {};
 
     if (extra !== null) {
       data.extra = extra;
     }
 
     this._logData("suite_end", data);
   },
 
 
   /**
    * Unstructured logging functions. The "extra" parameter can always by used to
    * log suite specific data. If a "stack" field is provided it is logged at the
    * top level of the data object for the benefit of mozlog's formatters.
    */
-  log: function (level, message, extra=null) {
+  log(level, message, extra = null) {
     var data = {
-      level: level,
+      level,
       message: String(message),
     };
 
     if (extra !== null) {
       data.extra = extra;
       if ("stack" in extra) {
         data.stack = extra.stack;
       }
     }
 
     this._logData("log", data);
   },
 
-  debug: function (message, extra=null) {
+  debug(message, extra = null) {
     this.log("DEBUG", message, extra);
   },
 
-  info: function (message, extra=null) {
+  info(message, extra = null) {
     this.log("INFO", message, extra);
   },
 
-  warning: function (message, extra=null) {
+  warning(message, extra = null) {
     this.log("WARNING", message, extra);
   },
 
-  error: function (message, extra=null) {
+  error(message, extra = null) {
     this.log("ERROR", message, extra);
   },
 
-  critical: function (message, extra=null) {
+  critical(message, extra = null) {
     this.log("CRITICAL", message, extra);
   },
 
-  processOutput: function(thread, message) {
-    this._logData('process_output', {
-      message: message,
-      thread: thread,
+  processOutput(thread, message) {
+    this._logData("process_output", {
+      message,
+      thread,
     });
   },
 
 
-  _logData: function (action, data={}) {
+  _logData(action, data = {}) {
     var allData = {
-      action: action,
+      action,
       time: Date.now(),
       thread: null,
       pid: null,
       source: this.name
     };
 
     for (var field in data) {
       allData[field] = data[field];
@@ -192,17 +192,17 @@ StructuredLogger.prototype = {
 
     for (var fun of this._mutatorFuns) {
       fun(allData);
     }
 
     this._dumpFun(allData);
   },
 
-  _testId: function(test) {
+  _testId(test) {
     if (Array.isArray(test)) {
       return test.join(" ");
     }
     return test;
   },
 };
 
 
@@ -211,52 +211,52 @@ StructuredLogger.prototype = {
  * into human-readable messages.
  */
 this.StructuredFormatter = function() {
     this.testStartTimes = {};
 };
 
 StructuredFormatter.prototype = {
 
-  log: function(message) {
+  log(message) {
     return message.message;
   },
 
-  suite_start: function(message) {
+  suite_start(message) {
     this.suiteStartTime = message.time;
-    return "SUITE-START | Running " +  message.tests.length + " tests";
+    return "SUITE-START | Running " + message.tests.length + " tests";
   },
 
-  test_start: function(message) {
+  test_start(message) {
     this.testStartTimes[message.test] = new Date().getTime();
     return "TEST-START | " + message.test;
   },
 
-  test_status: function(message) {
+  test_status(message) {
     var statusInfo = message.test + " | " + message.subtest +
                     (message.message ? " | " + message.message : "");
     if (message.expected) {
         return "TEST-UNEXPECTED-" + message.status + " | " + statusInfo +
                " - expected: " + message.expected;
-    } else {
+    }
         return "TEST-" + message.status + " | " + statusInfo;
-    }
+
   },
 
-  test_end: function(message) {
+  test_end(message) {
     var startTime = this.testStartTimes[message.test];
     delete this.testStartTimes[message.test];
     var statusInfo = message.test + (message.message ? " | " + String(message.message) : "");
     var result;
     if (message.expected) {
         result = "TEST-UNEXPECTED-" + message.status + " | " + statusInfo +
                  " - expected: " + message.expected;
     } else {
         return "TEST-" + message.status + " | " + statusInfo;
     }
     result = " | took " + message.time - startTime + "ms";
   },
 
-  suite_end: function(message) {
+  suite_end(message) {
     return "SUITE-END | took " + message.time - this.suiteStartTime + "ms";
   }
 };
 
new file mode 100644
--- /dev/null
+++ b/testing/modules/tests/browser/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/browser-test"
+  ]
+};
new file mode 100644
--- /dev/null
+++ b/testing/modules/tests/xpcshell/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/xpcshell-test"
+  ]
+};
--- a/testing/modules/tests/xpcshell/test_assert.js
+++ b/testing/modules/tests/xpcshell/test_assert.js
@@ -26,17 +26,17 @@ function run_test() {
 
   function indirectInstanceOf(obj, cls) {
     if (obj instanceof cls) {
       return true;
     }
     let clsChain = protoCtrChain(cls.prototype);
     let objChain = protoCtrChain(obj);
     return objChain.slice(-clsChain.length) === clsChain;
-  };
+  }
 
   assert.ok(indirectInstanceOf(ns.Assert.AssertionError.prototype, Error),
             "Assert.AssertionError instanceof Error");
 
   assert.throws(makeBlock(assert.ok, false),
                 ns.Assert.AssertionError, "ok(false)");
 
   assert.ok(true, "ok(true)");
@@ -113,17 +113,17 @@ function run_test() {
   a1.b = true;
   a2.b = true;
   a2.a = "test";
   assert.throws(makeBlock(assert.deepEqual, Object.keys(a1), Object.keys(a2)),
                 ns.Assert.AssertionError);
   assert.deepEqual(a1, a2);
 
   let nbRoot = {
-    toString: function() { return this.first + " " + this.last; }
+    toString() { return this.first + " " + this.last; }
   };
 
   function nameBuilder(first, last) {
     this.first = first;
     this.last = last;
     return this;
   }
   nameBuilder.prototype = nbRoot;
@@ -241,17 +241,17 @@ function run_test() {
   testAssertionMessage(function f() {}, '"function f() {}"');
   testAssertionMessage({}, "{}");
   testAssertionMessage({a: undefined, b: null}, '{"a":"undefined","b":null}');
   testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
       '{"a":"NaN","b":"Infinity","c":"-Infinity"}');
 
   // https://github.com/joyent/node/issues/2893
   try {
-    assert.throws(function () {
+    assert.throws(function() {
       ifError(null);
     });
   } catch (e) {
     threw = true;
     assert.equal(e.message, "Missing expected exception..");
   }
   assert.ok(threw);
 
@@ -273,53 +273,53 @@ function run_test() {
   deepEqual(/a/g, /a/g, "deep equal should work on RegExp");
   deepEqual(/a/igm, /a/igm, "deep equal should work on RegExp");
   deepEqual({a: 4, b: "1"}, {b: "1", a: 4}, "deep equal should work on regular Object");
   deepEqual(a1, a2, "deep equal should work on Array with Object properties");
 
   // Test robustness of reporting:
   equal(new ns.Assert.AssertionError({
     actual: {
-      toJSON: function() {
+      toJSON() {
         throw "bam!";
       }
     },
     expected: "foo",
     operator: "="
   }).message, "[object Object] = \"foo\"");
 
   let message;
   assert.greater(3, 2);
   try {
     assert.greater(2, 2);
-  } catch(e) {
+  } catch (e) {
     message = e.toString().split("\n")[0];
   }
   assert.equal(message, "AssertionError: 2 > 2");
 
   assert.greaterOrEqual(2, 2);
   try {
     assert.greaterOrEqual(1, 2);
-  } catch(e) {
+  } catch (e) {
     message = e.toString().split("\n")[0];
   }
   assert.equal(message, "AssertionError: 1 >= 2");
 
   assert.less(1, 2);
   try {
     assert.less(2, 2);
-  } catch(e) {
+  } catch (e) {
     message = e.toString().split("\n")[0];
   }
   assert.equal(message, "AssertionError: 2 < 2");
 
   assert.lessOrEqual(2, 2);
   try {
     assert.lessOrEqual(2, 1);
-  } catch(e) {
+  } catch (e) {
     message = e.toString().split("\n")[0];
   }
   assert.equal(message, "AssertionError: 2 <= 1");
 
   run_next_test();
 }
 
 add_task(async function test_rejects() {
@@ -327,17 +327,17 @@ add_task(async function test_rejects() {
   Components.utils.import("resource://testing-common/Assert.jsm", ns);
   let assert = new ns.Assert();
 
   // A helper function to test failures.
   async function checkRejectsFails(err, expected) {
     try {
       await assert.rejects(Promise.reject(err), expected);
       ok(false, "should have thrown");
-    } catch(ex) {
+    } catch (ex) {
       deepEqual(ex, err, "Assert.rejects threw the original unexpected error");
     }
   }
 
   // A "throwable" error that's not an actual Error().
   let SomeErrorLikeThing = function() {};
 
   // The actual tests...
--- a/testing/modules/tests/xpcshell/test_mockRegistrar.js
+++ b/testing/modules/tests/xpcshell/test_mockRegistrar.js
@@ -12,17 +12,17 @@ function userInfo(username) {
 
 userInfo.prototype = {
   fullname: "fullname",
   emailAddress: "emailAddress",
   domain: "domain",
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIUserInfo]),
 };
 
-function run_test () {
+function run_test() {
   run_next_test();
 }
 
 add_test(function test_register() {
   let localUserInfo = {
     fullname: "fullname",
     username: "localusername",
     emailAddress: "emailAddress",
--- a/testing/modules/tests/xpcshell/test_structuredlog.js
+++ b/testing/modules/tests/xpcshell/test_structuredlog.js
@@ -1,49 +1,49 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function run_test () {
+function run_test() {
   Components.utils.import("resource://testing-common/StructuredLog.jsm");
 
   let testBuffer = [];
 
-  let appendBuffer = function (msg) {
+  let appendBuffer = function(msg) {
     testBuffer.push(JSON.stringify(msg));
   }
 
-  let assertLastMsg = function (refData) {
+  let assertLastMsg = function(refData) {
     // Check all fields in refData agree with those in the
     // last message logged, and pop that message.
     let lastMsg = JSON.parse(testBuffer.pop());
     for (let field in refData) {
       deepEqual(lastMsg[field], refData[field]);
     }
     // The logger should always set the source to the logger name.
     equal(lastMsg.source, "test_log");
     // The source_file field is always set by the mutator function.
     equal(lastMsg.source_file, "test_structuredlog.js");
   }
 
-  let addFileName = function (data) {
+  let addFileName = function(data) {
     data.source_file = "test_structuredlog.js";
   }
 
   let logger = new StructuredLogger("test_log", appendBuffer, [addFileName]);
 
   // Test unstructured logging
   logger.info("Test message");
   assertLastMsg({
     action: "log",
     message: "Test message",
     level: "INFO",
   });
 
   logger.info("Test message",
-              extra={foo: "bar"});
+              extra = {foo: "bar"});
   assertLastMsg({
     action: "log",
     message: "Test message",
     level: "INFO",
     extra: {foo: "bar"},
   });
 
   // Test end / start actions