Bug 1594964 - Unify linting rules for test directories. r=pmorris

--HG--
rename : mailnews/mime/jsmime/test/data/base64-1 => mailnews/mime/jsmime/test/unit/data/base64-1
rename : mailnews/mime/jsmime/test/data/base64-2 => mailnews/mime/jsmime/test/unit/data/base64-2
rename : mailnews/mime/jsmime/test/data/basic1 => mailnews/mime/jsmime/test/unit/data/basic1
rename : mailnews/mime/jsmime/test/data/bug505221 => mailnews/mime/jsmime/test/unit/data/bug505221
rename : mailnews/mime/jsmime/test/data/bugmail11 => mailnews/mime/jsmime/test/unit/data/bugmail11
rename : mailnews/mime/jsmime/test/data/charsets => mailnews/mime/jsmime/test/unit/data/charsets
rename : mailnews/mime/jsmime/test/data/message-encoded => mailnews/mime/jsmime/test/unit/data/message-encoded
rename : mailnews/mime/jsmime/test/data/mime-torture => mailnews/mime/jsmime/test/unit/data/mime-torture
rename : mailnews/mime/jsmime/test/data/multipart-base64-1 => mailnews/mime/jsmime/test/unit/data/multipart-base64-1
rename : mailnews/mime/jsmime/test/data/multipart-base64-2 => mailnews/mime/jsmime/test/unit/data/multipart-base64-2
rename : mailnews/mime/jsmime/test/data/multipart-base64-3 => mailnews/mime/jsmime/test/unit/data/multipart-base64-3
rename : mailnews/mime/jsmime/test/data/multipart-complex1 => mailnews/mime/jsmime/test/unit/data/multipart-complex1
rename : mailnews/mime/jsmime/test/data/multipart-complex2 => mailnews/mime/jsmime/test/unit/data/multipart-complex2
rename : mailnews/mime/jsmime/test/data/multipart1 => mailnews/mime/jsmime/test/unit/data/multipart1
rename : mailnews/mime/jsmime/test/data/multipart2 => mailnews/mime/jsmime/test/unit/data/multipart2
rename : mailnews/mime/jsmime/test/data/multipart3 => mailnews/mime/jsmime/test/unit/data/multipart3
rename : mailnews/mime/jsmime/test/data/multipart4 => mailnews/mime/jsmime/test/unit/data/multipart4
rename : mailnews/mime/jsmime/test/data/multipartmalt-detach => mailnews/mime/jsmime/test/unit/data/multipartmalt-detach
rename : mailnews/mime/jsmime/test/data/shift-jis-image => mailnews/mime/jsmime/test/unit/data/shift-jis-image
rename : mailnews/mime/jsmime/test/head_xpcshell_glue.js => mailnews/mime/jsmime/test/unit/head_xpcshell_glue.js
rename : mailnews/mime/jsmime/test/mock_date.js => mailnews/mime/jsmime/test/unit/mock_date.js
rename : mailnews/mime/jsmime/test/test_custom_headers.js => mailnews/mime/jsmime/test/unit/test_custom_headers.js
rename : mailnews/mime/jsmime/test/test_header.js => mailnews/mime/jsmime/test/unit/test_header.js
rename : mailnews/mime/jsmime/test/test_header_emitter.js => mailnews/mime/jsmime/test/unit/test_header_emitter.js
rename : mailnews/mime/jsmime/test/test_mime_tree.js => mailnews/mime/jsmime/test/unit/test_mime_tree.js
rename : mailnews/mime/jsmime/test/test_structured_header_emitters.js => mailnews/mime/jsmime/test/unit/test_structured_header_emitters.js
rename : mailnews/mime/jsmime/test/test_structured_headers.js => mailnews/mime/jsmime/test/unit/test_structured_headers.js
rename : mailnews/mime/jsmime/test/xpcshell.ini => mailnews/mime/jsmime/test/unit/xpcshell.ini
This commit is contained in:
Geoff Lankow 2019-11-05 16:48:02 +13:00
Родитель 367e068acf
Коммит 0add81ce54
45 изменённых файлов: 31 добавлений и 120 удалений

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

@ -91,11 +91,14 @@ module.exports = {
},
},
{
// If it is an xpcshell head file, we turn off global unused variable checks, as it
// If it is a test head file, we turn off global unused variable checks, as it
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
// We could get developers to declare as exported, but that doesn't seem worth it.
files: xpcshellTestPaths.map(path => `${path}head*.js`),
files: [
...browserTestPaths.map(path => `${path}head*.js`),
...xpcshellTestPaths.map(path => `${path}head*.js`),
],
rules: {
"no-unused-vars": [
"error",

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

@ -521,5 +521,21 @@ module.exports = {
],
},
},
{
// If it is a test head file, we turn off global unused variable checks, as it
// would require searching the other test files to know if they are used or not.
// This would be expensive and slow, and it isn't worth it for head files.
// We could get developers to declare as exported, but that doesn't seem worth it.
files: ["test/**/head*.js"],
rules: {
"no-unused-vars": [
"error",
{
args: "none",
vars: "local",
},
],
},
},
],
};

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

@ -2,11 +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/. */
/* exported closeAddonsTab, closeCalendarTab, closeChatTab, closePreferencesTab, closeTasksTab,
openAddonsTab, openCalendarTab, openChatTab, openNewCalendarEventTab, openNewCalendarTaskTab,
openPreferencesTab, openTasksTab, selectCalendarEventTab, selectCalendarTaskTab,
selectFolderTab, setCalendarView */
/* import-globals-from ../../base/content/calendar-views-utils.js */
/* globals openOptionsDialog, openAddonsMgr */

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

@ -1,21 +0,0 @@
"use strict";
module.exports = {
extends: ["plugin:mozilla/xpcshell-test"],
rules: {
// Allow non-camelcase so that run_test doesn't produce a warning.
camelcase: 0,
// Allow using undefined variables so that tests can refer to functions
// and variables defined in head.js files, without having to maintain a
// list of globals in each .eslintrc file.
// Note that bug 1168340 will eventually help auto-registering globals
// from head.js files.
"no-undef": 0,
"block-scoped-var": 0,
// Allow run_test to be unused in xpcshell
"no-unused-vars": [2, { vars: "all", args: "none", varsIgnorePattern: "run_test" }],
// Allow function names, because they are useful for add_test/add_task
"func-names": 0,
},
};

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

@ -2,11 +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/. */
/* exported do_calendar_startup, do_load_calmgr, do_load_timezoneservice, readJSONFile,
* ics_unfoldline, dedent, compareItemsSpecific, getStorageCal, getMemoryCal,
* createTodoFromIcalString, createEventFromIcalString, createDate, Cc, Ci, Cr, Cu
*/
var { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
@ -310,7 +305,7 @@ function do_calendar_startup(callback) {
} else {
do_test_pending();
Services.obs.addObserver(obs, "calendar-startup-done");
if (_profileInitialized) {
if (this._profileInitialized) {
Services.obs.notifyObservers(null, "profile-after-change", "xpcshell-do-get-profile");
} else {
do_get_profile(true);

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

@ -182,7 +182,7 @@ function test_overrides() {
Services.prefs.setStringPref("calendar.patterns.override", JSON.stringify(overrides));
collected = extractor.extract(title, content, date, undefined);
extractor.extract(title, content, date, undefined);
guessed = extractor.guessStart(false);
endGuess = extractor.guessEnd(guessed, true);

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

@ -21,7 +21,7 @@ function test_found() {
let provider1 = {
id: 1,
getFreeBusyIntervals: function() {
getFreeBusyIntervals: function(aCalId, aStart, aEnd, aTypes, aListener) {
aListener.onResult(null, []);
},
};

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

@ -203,7 +203,7 @@ function test_getSequence() {
];
for (let i = 1; i <= data.length; i++) {
let test = data[i - 1];
testItems = getSeqStampTestItems(test);
let testItems = getSeqStampTestItems(test);
equal(cal.itip.getSequence(testItems[0], testItems[1]), test.expected, "(test #" + i + ")");
}
}
@ -299,7 +299,7 @@ function test_compareSequence() {
];
for (let i = 1; i <= data.length; i++) {
let test = data[i - 1];
testItems = getSeqStampTestItems(test);
let testItems = getSeqStampTestItems(test);
equal(cal.itip.compareSequence(testItems[0], testItems[1]), test.expected, "(test #" + i + ")");
}
}
@ -374,7 +374,7 @@ function test_compareStamp() {
];
for (let i = 1; i <= data.length; i++) {
let test = data[i - 1];
testItems = getSeqStampTestItems(test);
let testItems = getSeqStampTestItems(test);
equal(cal.itip.compareStamp(testItems[0], testItems[1]), test.expected, "(test #" + i + ")");
}
}
@ -458,7 +458,7 @@ function test_compare() {
];
for (let i = 1; i <= data.length; i++) {
let test = data[i - 1];
testItems = getSeqStampTestItems(test);
let testItems = getSeqStampTestItems(test);
equal(cal.itip.compare(testItems[0], testItems[1]), test.expected, "(test #" + i + ")");
}
}

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

@ -1105,7 +1105,7 @@ function test_failures() {
}
function test_immutable() {
item = createTodoFromIcalString(
let item = createTodoFromIcalString(
"BEGIN:VCALENDAR\r\n" +
"BEGIN:VTODO\r\n" +
"RRULE:FREQ=DAILY\r\n" +

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

@ -1,10 +0,0 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/browser-test",
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
},
};

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

@ -1,10 +0,0 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/browser-test",
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
},
};

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

@ -1,14 +1,7 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/browser-test",
env: {
webextensions: true,
},
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
},
};

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

@ -1,16 +1,7 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/xpcshell-test",
env: {
// The tests in this folder are testing based on WebExtensions, so lets
// just define the webextensions environment here.
webextensions: true,
},
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
},
};

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

@ -1,21 +0,0 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/xpcshell-test",
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
"no-unused-vars": [
"error",
{
args: "none",
vars: "all",
},
],
},
globals: {
do_report_result: false,
},
};

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

@ -1,4 +1,3 @@
/* exported mailTestUtils */
var { mailTestUtils } = ChromeUtils.import(
"resource://testing-common/mailnews/mailTestUtils.js"
);

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

@ -1,17 +0,0 @@
"use strict";
module.exports = {
extends: "plugin:mozilla/xpcshell-test",
rules: {
"func-names": "off",
"mozilla/import-headjs-globals": "error",
"no-unused-vars": [
"error",
{
args: "none",
vars: "all",
},
],
},
};

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

@ -80,7 +80,6 @@ function innerDefine(moduleName, dfn) {
requireCache.set(moduleName, result);
}
/* exported define */
var define = innerDefine.bind(this, "xpcshell-test");
// Mocha TDD UI Bindings
@ -144,7 +143,6 @@ function runFunction(fn) {
return completed;
}
/* exported suite, test, setup, teardown, run_test */
var currentSuite = new MochaSuite("");
function suite(name, tests) {
name = name.toString();

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

@ -17,7 +17,7 @@ EXTRA_JS_MODULES.jsmime += [
]
TESTING_JS_MODULES.jsmime += [
'jsmime/test/mock_date.js',
'jsmime/test/unit/mock_date.js',
]
XPCSHELL_TESTS_MANIFESTS += ['jsmime/test/xpcshell.ini']
XPCSHELL_TESTS_MANIFESTS += ['jsmime/test/unit/xpcshell.ini']