Bug 1746601 - Wait for scrollOffset to be updated in test, r=webdriver-reviewers...
[gecko.git] / .eslintrc-test-paths.js
blobe93e11ff34383ab104af823645bf05c499839126
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 /* eslint-env node */
9 // The `*testPaths` defined below for test paths are the main path formats we
10 // prefer to support for tests as they are commonly used across the tree.
12 // We prefer the tests to be in named directories as this makes it easier
13 // to identify the types of tests developers are working with. Additionally,
14 // it is not possible to scope ESLint rules to individual files based on .ini
15 // files without a build step that would break editors, or an expensive loading
16 // cycle.
18 // Please do not add more cases of multiple test types in a single
19 // directory. This may cause ESLint rules to be incorrectly applied to the wrong
20 // tests, leading to false negatives. It could cause the wrong sets of globals
21 // to be defined in the scope, causing false positives when checking for no
22 // undefined variables.
24 // See https://firefox-source-docs.mozilla.org/code-quality/lint/linters/eslint.html#i-m-adding-tests-how-do-i-set-up-the-right-configuration
25 // for more information.
27 const browserTestPaths = ["**/test*/**/browser*/"];
29 const chromeTestPaths = ["**/test*/chrome/"];
31 const mochitestTestPaths = [
32   // Note: we do not want to match testing/mochitest as that would apply
33   // too many globals for that directory.
34   "**/test/mochitest/",
35   "**/tests/mochitest/",
36   "**/test/mochitests/",
37   "testing/mochitest/tests/SimpleTest/",
38   "testing/mochitest/tests/Harness_sanity/",
41 const xpcshellTestPaths = [
42   "**/test*/unit*/**/",
43   "**/test*/*/unit*/",
44   "**/test*/xpcshell/**/",
47 // NOTE: Before adding to the list below, please see the note at the top
48 // of the file.
50 const extraXpcshellTestPaths = [
51   "devtools/platform/tests/xpcshell/",
52   "dom/file/tests/",
53   "dom/ipc/tests/",
54   "intl/benchmarks/",
55   "intl/l10n/test/",
56   "ipc/testshell/tests/",
57   "memory/replace/dmd/test/",
58   "netwerk/test/httpserver/test/",
59   "testing/modules/tests/xpcshell/",
60   "toolkit/components/backgroundhangmonitor/tests/",
61   "toolkit/components/downloads/test/data/",
62   "toolkit/components/mozintl/test/",
63   "toolkit/components/places/tests/",
64   "toolkit/components/places/tests/bookmarks/",
65   "toolkit/components/places/tests/expiration/",
66   "toolkit/components/places/tests/favicons/",
67   "toolkit/components/places/tests/history/",
68   "toolkit/components/places/tests/legacy/",
69   "toolkit/components/places/tests/migration/",
70   "toolkit/components/places/tests/queries/",
71   "toolkit/components/thumbnails/test/",
72   "toolkit/modules/tests/modules/",
73   "toolkit/mozapps/update/tests/data/",
74   "toolkit/profile/xpcshell/",
75   "toolkit/xre/test/",
76   "widget/headless/tests/",
79 // NOTE: Before adding to the list below, please see the note at the top
80 // of the file.
82 const extraBrowserTestPaths = [
83   "dom/ipc/tests/",
84   "toolkit/components/thumbnails/test/",
85   "toolkit/xre/test/",
86   "browser/base/content/test/about/",
87   "browser/base/content/test/alerts/",
88   "browser/base/content/test/backforward/",
89   "browser/base/content/test/caps/",
90   "browser/base/content/test/captivePortal/",
91   "browser/base/content/test/contentTheme/",
92   "browser/base/content/test/contextMenu/",
93   "browser/base/content/test/favicons/",
94   "browser/base/content/test/forms/",
95   "browser/base/content/test/fullscreen/",
96   "browser/base/content/test/general/",
97   "browser/base/content/test/gesture/",
98   "browser/base/content/test/historySwipeAnimation/",
99   "browser/base/content/test/keyboard/",
100   "browser/base/content/test/menubar/",
101   "browser/base/content/test/metaTags/",
102   "browser/base/content/test/notificationbox/",
103   "browser/base/content/test/outOfProcess/",
104   "browser/base/content/test/pageActions/",
105   "browser/base/content/test/pageStyle/",
106   "browser/base/content/test/pageinfo/",
107   "browser/base/content/test/performance/",
108   "browser/base/content/test/permissions/",
109   "browser/base/content/test/plugins/",
110   "browser/base/content/test/popupNotifications/",
111   "browser/base/content/test/popups/",
112   "browser/base/content/test/protectionsUI/",
113   "browser/base/content/test/referrer/",
114   "browser/base/content/test/sanitize/",
115   "browser/base/content/test/sidebar/",
116   "browser/base/content/test/siteIdentity/",
117   "browser/base/content/test/startup/",
118   "browser/base/content/test/static/",
119   "browser/base/content/test/statuspanel/",
120   "browser/base/content/test/sync/",
121   "browser/base/content/test/tabMediaIndicator/",
122   "browser/base/content/test/tabPrompts/",
123   "browser/base/content/test/tabcrashed/",
124   "browser/base/content/test/tabdialogs/",
125   "browser/base/content/test/tabs/",
126   "browser/base/content/test/touch/",
127   "browser/base/content/test/utilityOverlay/",
128   "browser/base/content/test/webextensions/",
129   "browser/base/content/test/webrtc/",
130   "browser/base/content/test/zoom/",
131   "browser/components/customizableui/test/",
132   "browser/components/pocket/test/",
133   "browser/components/preferences/tests/",
134   "browser/components/safebrowsing/content/test/",
135   "browser/components/sessionstore/test/",
136   "browser/components/shell/test/",
137   "browser/components/touchbar/tests/",
138   "browser/components/translation/test/",
139   "browser/components/uitour/test/",
140   "browser/extensions/report-site-issue/test/browser/",
141   "browser/tools/mozscreenshots/",
142   "caps/tests/mochitest/",
143   "devtools/client/debugger/test/mochitest/",
144   "devtools/client/dom/test/",
145   "devtools/client/framework/browser-toolbox/test/",
146   "devtools/client/framework/test/",
147   "devtools/client/inspector/animation/test/",
148   "devtools/client/inspector/boxmodel/test/",
149   "devtools/client/inspector/changes/test/",
150   "devtools/client/inspector/computed/test/",
151   "devtools/client/inspector/extensions/test/",
152   "devtools/client/inspector/flexbox/test/",
153   "devtools/client/inspector/fonts/test/",
154   "devtools/client/inspector/grids/test/",
155   "devtools/client/inspector/markup/test/",
156   "devtools/client/inspector/rules/test/",
157   "devtools/client/inspector/shared/test/",
158   "devtools/client/inspector/test/",
159   "devtools/client/jsonview/test/",
160   "devtools/client/memory/test/browser/",
161   "devtools/client/netmonitor/src/har/test/",
162   "devtools/client/netmonitor/test/",
163   "devtools/client/shared/sourceeditor/test/",
164   "devtools/client/shared/test/",
165   "devtools/client/storage/test/",
166   "devtools/client/styleeditor/test/",
167   "devtools/shared/commands/inspected-window/tests/",
168   "devtools/shared/commands/inspector/tests/",
169   "devtools/shared/commands/resource/tests/",
170   "devtools/shared/commands/script/tests/",
171   "devtools/shared/commands/target-configuration/tests/",
172   "devtools/shared/commands/target/tests/",
173   "devtools/shared/commands/thread-configuration/tests/",
174   "devtools/shared/test-helpers/",
175   "docshell/test/navigation/",
176   "dom/base/test/",
177   "dom/broadcastchannel/tests/",
178   "dom/events/test/",
179   "dom/fetch/tests/",
180   "dom/html/test/",
181   "dom/indexedDB/test/",
182   "dom/ipc/tests/",
183   "dom/l10n/tests/mochitest/",
184   "dom/localstorage/test/",
185   "dom/manifest/test/",
186   "dom/midi/tests/",
187   "dom/payments/test/",
188   "dom/plugins/test/mochitest/",
189   "dom/reporting/tests/",
190   "dom/security/test/general/",
191   "dom/security/test/https-first/",
192   "dom/security/test/https-only/",
193   "dom/security/test/referrer-policy/",
194   "dom/security/test/sec-fetch/",
195   "dom/serviceworkers/test/",
196   "dom/tests/browser/",
197   "dom/url/tests/",
198   "dom/workers/test/",
199   "dom/xhr/tests/",
200   "editor/libeditor/tests/",
201   "extensions/permissions/test/",
202   "layout/base/tests/",
203   "layout/style/test/",
204   "layout/xul/test/",
205   "parser/htmlparser/tests/mochitest/",
206   "security/sandbox/test/",
207   "testing/mochitest/baselinecoverage/browser_chrome/",
208   "testing/mochitest/tests/python/files/",
209   "toolkit/components/alerts/test/",
210   "toolkit/components/mozprotocol/tests/",
211   "toolkit/components/narrate/test/",
212   "toolkit/components/pdfjs/test/",
213   "toolkit/components/pictureinpicture/tests/",
214   "toolkit/components/printing/tests/",
215   "toolkit/components/reader/test/",
216   "toolkit/components/thumbnails/test/",
217   "toolkit/components/tooltiptext/tests/",
218   "toolkit/components/windowcreator/test/",
219   "toolkit/components/windowwatcher/test/",
220   "toolkit/mozapps/extensions/test/xpinstall/",
221   "uriloader/exthandler/tests/mochitest/",
224 // NOTE: Before adding to the list below, please see the note at the top
225 // of the file.
227 const extraChromeTestPaths = [
228   "devtools/shared/security/tests/chrome/",
229   "devtools/shared/webconsole/test/chrome/",
230   "dom/base/test/",
231   "dom/battery/test/",
232   "dom/bindings/test/",
233   "dom/console/tests/",
234   "dom/encoding/test/",
235   "dom/events/test/",
236   "dom/flex/test/",
237   "dom/grid/test/",
238   "dom/html/test/",
239   "dom/html/test/forms/",
240   "dom/indexedDB/test/",
241   "dom/messagechannel/tests/",
242   "dom/network/tests/",
243   "dom/promise/tests/",
244   "dom/security/test/general/",
245   "dom/security/test/sec-fetch/",
246   "dom/serviceworkers/test/",
247   "dom/system/tests/",
248   "dom/url/tests/",
249   "dom/websocket/tests/",
250   "dom/workers/test/",
251   "dom/xul/test/",
252   "editor/composer/test/",
253   "extensions/universalchardet/tests/",
254   "gfx/layers/apz/test/mochitest/",
255   "image/test/mochitest/",
256   "layout/forms/test/",
257   "layout/generic/test/",
258   "layout/mathml/tests/",
259   "layout/svg/tests/",
260   "layout/xul/test/",
261   "toolkit/components/aboutmemory/tests/",
262   "toolkit/components/osfile/tests/mochi/",
263   "toolkit/components/printing/tests/",
264   "toolkit/components/url-classifier/tests/mochitest/",
265   "toolkit/components/viewsource/test/",
266   "toolkit/components/windowcreator/test/",
267   "toolkit/components/windowwatcher/test/",
268   "toolkit/components/workerloader/tests/",
269   "toolkit/content/tests/widgets/",
270   "toolkit/profile/test/",
271   "widget/tests/",
272   "xpfe/appshell/test/",
275 // NOTE: Before adding to the list below, please see the note at the top
276 // of the file.
278 const extraMochitestTestPaths = [
279   "dom/file/tests/",
280   "dom/ipc/tests/",
281   "toolkit/xre/test/",
282   "accessible/tests/crashtests/",
283   "browser/components/protocolhandler/test/",
284   "caps/tests/mochitest/",
285   "docshell/test/iframesandbox/",
286   "docshell/test/navigation/",
287   "dom/abort/tests/",
288   "dom/animation/test/mozilla/",
289   "dom/animation/test/style/",
290   "dom/base/test/",
291   "dom/battery/test/",
292   "dom/bindings/test/",
293   "dom/broadcastchannel/tests/",
294   "dom/canvas/test/",
295   "dom/console/tests/",
296   "dom/credentialmanagement/tests/",
297   "dom/crypto/test/",
298   "dom/encoding/test/",
299   "dom/events/test/",
300   "dom/file/tests/",
301   "dom/filesystem/compat/tests/",
302   "dom/filesystem/tests/",
303   "dom/html/test/",
304   "dom/html/test/forms/",
305   "dom/indexedDB/test/",
306   "dom/ipc/tests/",
307   "dom/jsurl/test/",
308   "dom/localstorage/test/",
309   "dom/locks/test/",
310   "dom/manifest/test/",
311   "dom/media/mediasession/test/",
312   "dom/media/mediasource/test/",
313   "dom/media/test/",
314   "dom/media/webspeech/recognition/test/",
315   "dom/media/webspeech/synth/test/",
316   "dom/messagechannel/tests/",
317   "dom/midi/tests/",
318   "dom/network/tests/",
319   "dom/payments/test/",
320   "dom/performance/tests/",
321   "dom/permission/tests/",
322   "dom/plugins/test/mochitest/",
323   "dom/promise/tests/",
324   "dom/push/test/",
325   "dom/quota/test/modules/content/",
326   "dom/reporting/tests/",
327   "dom/security/test/https-only/",
328   "dom/security/test/referrer-policy/",
329   "dom/security/test/sec-fetch/",
330   "dom/security/test/sri/",
331   "dom/serviceworkers/test/",
332   "dom/smil/test/",
333   "dom/svg/test/",
334   "dom/system/tests/",
335   "dom/u2f/tests/",
336   "dom/url/tests/",
337   "dom/webauthn/tests/",
338   "dom/websocket/tests/",
339   "dom/workers/test/",
340   "dom/worklet/tests/",
341   "dom/xhr/tests/",
342   "dom/xml/test/",
343   "dom/xul/test/",
344   "editor/composer/test/",
345   "editor/libeditor/tests/",
346   "editor/spellchecker/tests/",
347   "extensions/permissions/test/",
348   "gfx/layers/apz/test/mochitest/",
349   "image/test/mochitest/",
350   "intl/uconv/tests/",
351   "layout/base/tests/",
352   "layout/forms/test/",
353   "layout/generic/test/",
354   "layout/inspector/tests/",
355   "layout/mathml/tests/",
356   "layout/style/test/",
357   "layout/svg/tests/",
358   "layout/tables/test/",
359   "layout/xul/test/",
360   "parser/htmlparser/tests/mochitest/",
361   "services/sync/tests/tps/",
362   "testing/mochitest/baselinecoverage/plain/",
363   "testing/mochitest/tests/python/files/",
364   "toolkit/components/alerts/test/",
365   "toolkit/components/passwordmgr/test/mochitest/",
366   "toolkit/components/prompts/test/",
367   "toolkit/components/satchel/test/",
368   "toolkit/components/url-classifier/tests/mochitest/",
369   "toolkit/components/windowcreator/test/",
370   "toolkit/components/windowwatcher/test/",
371   "toolkit/content/tests/widgets/",
372   "toolkit/xre/test/",
373   "uriloader/exthandler/tests/mochitest/",
374   "widget/tests/",
377 // Please DO NOT add more entries to the list below.
378 // Doing so may cause conflicts in ESLint rules and globals, and cause
379 // unexpected issues to be raised or missed.
380 let expectedDupePaths = new Set([
381   "caps/tests/mochitest/",
382   "docshell/test/navigation/",
383   "dom/base/test/",
384   "dom/battery/test/",
385   "dom/bindings/test/",
386   "dom/broadcastchannel/tests/",
387   "dom/console/tests/",
388   "dom/encoding/test/",
389   "dom/events/test/",
390   "dom/file/tests/",
391   "dom/indexedDB/test/",
392   "dom/ipc/tests/",
393   "dom/localstorage/test/",
394   "dom/html/test/",
395   "dom/html/test/forms/",
396   "dom/manifest/test/",
397   "dom/messagechannel/tests/",
398   "dom/midi/tests/",
399   "dom/network/tests/",
400   "dom/payments/test/",
401   "dom/plugins/test/mochitest/",
402   "dom/promise/tests/",
403   "dom/reporting/tests/",
404   "dom/security/test/general/",
405   "dom/security/test/https-only/",
406   "dom/security/test/referrer-policy/",
407   "dom/security/test/sec-fetch/",
408   "dom/serviceworkers/test/",
409   "dom/system/tests/",
410   "dom/url/tests/",
411   "dom/websocket/tests/",
412   "dom/workers/test/",
413   "dom/xhr/tests/",
414   "dom/xul/test/",
415   "editor/composer/test/",
416   "editor/libeditor/tests/",
417   "extensions/permissions/test/",
418   "gfx/layers/apz/test/mochitest/",
419   "image/test/mochitest/",
420   "layout/base/tests/",
421   "layout/forms/test/",
422   "layout/generic/test/",
423   "layout/mathml/tests/",
424   "layout/style/test/",
425   "layout/svg/tests/",
426   "layout/xul/test/",
427   "parser/htmlparser/tests/mochitest/",
428   "testing/mochitest/tests/python/files/",
429   "toolkit/components/alerts/test/",
430   "toolkit/components/printing/tests/",
431   "toolkit/components/thumbnails/test/",
432   "toolkit/components/url-classifier/tests/mochitest/",
433   "toolkit/components/windowcreator/test/",
434   "toolkit/components/windowwatcher/test/",
435   "toolkit/content/tests/widgets/",
436   "toolkit/xre/test/",
437   "uriloader/exthandler/tests/mochitest/",
438   "widget/tests/",
440 // Please DO NOT add more paths to the list above.
442 let paths = new Set(extraXpcshellTestPaths);
443 for (let path of [
444   ...extraBrowserTestPaths,
445   ...extraChromeTestPaths,
446   ...extraMochitestTestPaths,
447 ]) {
448   if (paths.has(path) && !expectedDupePaths.has(path)) {
449     throw new Error(`
450 Unexpected directory containing different test types: ${path}
452 Please do not add new paths containing different test types. Please use
453 separate directories.
455 Having different test types in the same directory may cause ESLint rules to be
456 incorrectly applied.
458   }
459   paths.add(path);
462 module.exports = {
463   testPaths: {
464     browser: [...browserTestPaths, ...extraBrowserTestPaths],
465     chrome: [...chromeTestPaths, ...extraChromeTestPaths],
466     mochitest: [...mochitestTestPaths, ...extraMochitestTestPaths],
467     xpcshell: [...xpcshellTestPaths, ...extraXpcshellTestPaths],
468   },