1 | /**
|
2 | * @fileoverview Simply marks `test` (the test method) or `run_test` as used
|
3 | * when in mochitests or xpcshell tests respectively. This avoids ESLint telling
|
4 | * us that the function is never called.
|
5 | *
|
6 | * This Source Code Form is subject to the terms of the Mozilla Public
|
7 | * License, v. 2.0. If a copy of the MPL was not distributed with this
|
8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9 | */
|
10 |
|
11 | ;
|
12 |
|
13 | // -----------------------------------------------------------------------------
|
14 | // Rule Definition
|
15 | // -----------------------------------------------------------------------------
|
16 |
|
17 | var helpers = require("../helpers");
|
18 |
|
19 | module.exports = function(context) {
|
20 | // ---------------------------------------------------------------------------
|
21 | // Public
|
22 | // ---------------------------------------------------------------------------
|
23 |
|
24 | return {
|
25 | Program() {
|
26 | let testType = helpers.getTestType(context);
|
27 | if (testType == "browser") {
|
28 | context.markVariableAsUsed("test");
|
29 | return;
|
30 | }
|
31 |
|
32 | if (testType == "xpcshell") {
|
33 | context.markVariableAsUsed("run_test");
|
34 | }
|
35 | }
|
36 | };
|
37 | };
|