Bug 1791155 [wpt PR 35927] - Move webkit-mask-box-enumeration.html into compat/,...
[gecko.git] / .eslintrc-test-paths.js
blob8f2b135328be765a823d23a7c818267d5f424674
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   "netwerk/test/useragent/",
206   "parser/htmlparser/tests/mochitest/",
207   "security/sandbox/test/",
208   "testing/mochitest/baselinecoverage/browser_chrome/",
209   "testing/mochitest/tests/python/files/",
210   "toolkit/components/alerts/test/",
211   "toolkit/components/mozprotocol/tests/",
212   "toolkit/components/narrate/test/",
213   "toolkit/components/pdfjs/test/",
214   "toolkit/components/pictureinpicture/tests/",
215   "toolkit/components/printing/tests/",
216   "toolkit/components/reader/test/",
217   "toolkit/components/thumbnails/test/",
218   "toolkit/components/tooltiptext/tests/",
219   "toolkit/components/windowcreator/test/",
220   "toolkit/components/windowwatcher/test/",
221   "toolkit/mozapps/extensions/test/xpinstall/",
222   "uriloader/exthandler/tests/mochitest/",
225 // NOTE: Before adding to the list below, please see the note at the top
226 // of the file.
228 const extraChromeTestPaths = [
229   "devtools/shared/security/tests/chrome/",
230   "devtools/shared/webconsole/test/chrome/",
231   "dom/base/test/",
232   "dom/battery/test/",
233   "dom/bindings/test/",
234   "dom/console/tests/",
235   "dom/encoding/test/",
236   "dom/events/test/",
237   "dom/flex/test/",
238   "dom/grid/test/",
239   "dom/html/test/",
240   "dom/html/test/forms/",
241   "dom/indexedDB/test/",
242   "dom/messagechannel/tests/",
243   "dom/network/tests/",
244   "dom/promise/tests/",
245   "dom/security/test/general/",
246   "dom/security/test/sec-fetch/",
247   "dom/serviceworkers/test/",
248   "dom/system/tests/",
249   "dom/url/tests/",
250   "dom/websocket/tests/",
251   "dom/workers/test/",
252   "dom/xul/test/",
253   "editor/composer/test/",
254   "extensions/universalchardet/tests/",
255   "gfx/layers/apz/test/mochitest/",
256   "image/test/mochitest/",
257   "layout/forms/test/",
258   "layout/generic/test/",
259   "layout/mathml/tests/",
260   "layout/svg/tests/",
261   "layout/xul/test/",
262   "toolkit/components/aboutmemory/tests/",
263   "toolkit/components/osfile/tests/mochi/",
264   "toolkit/components/printing/tests/",
265   "toolkit/components/url-classifier/tests/mochitest/",
266   "toolkit/components/viewsource/test/",
267   "toolkit/components/windowcreator/test/",
268   "toolkit/components/windowwatcher/test/",
269   "toolkit/components/workerloader/tests/",
270   "toolkit/content/tests/widgets/",
271   "toolkit/profile/test/",
272   "widget/tests/",
273   "xpfe/appshell/test/",
276 // NOTE: Before adding to the list below, please see the note at the top
277 // of the file.
279 const extraMochitestTestPaths = [
280   "dom/file/tests/",
281   "dom/ipc/tests/",
282   "toolkit/xre/test/",
283   "accessible/tests/crashtests/",
284   "browser/components/protocolhandler/test/",
285   "caps/tests/mochitest/",
286   "docshell/test/iframesandbox/",
287   "docshell/test/navigation/",
288   "dom/abort/tests/",
289   "dom/animation/test/mozilla/",
290   "dom/animation/test/style/",
291   "dom/base/test/",
292   "dom/battery/test/",
293   "dom/bindings/test/",
294   "dom/broadcastchannel/tests/",
295   "dom/canvas/test/",
296   "dom/console/tests/",
297   "dom/credentialmanagement/tests/",
298   "dom/crypto/test/",
299   "dom/encoding/test/",
300   "dom/events/test/",
301   "dom/file/tests/",
302   "dom/filesystem/compat/tests/",
303   "dom/filesystem/tests/",
304   "dom/html/test/",
305   "dom/html/test/forms/",
306   "dom/indexedDB/test/",
307   "dom/ipc/tests/",
308   "dom/jsurl/test/",
309   "dom/localstorage/test/",
310   "dom/locks/test/",
311   "dom/manifest/test/",
312   "dom/media/mediasession/test/",
313   "dom/media/mediasource/test/",
314   "dom/media/test/",
315   "dom/media/webspeech/recognition/test/",
316   "dom/media/webspeech/synth/test/",
317   "dom/messagechannel/tests/",
318   "dom/midi/tests/",
319   "dom/network/tests/",
320   "dom/payments/test/",
321   "dom/performance/tests/",
322   "dom/permission/tests/",
323   "dom/plugins/test/mochitest/",
324   "dom/promise/tests/",
325   "dom/push/test/",
326   "dom/quota/test/modules/content/",
327   "dom/reporting/tests/",
328   "dom/security/test/https-only/",
329   "dom/security/test/referrer-policy/",
330   "dom/security/test/sec-fetch/",
331   "dom/security/test/sri/",
332   "dom/serviceworkers/test/",
333   "dom/smil/test/",
334   "dom/svg/test/",
335   "dom/system/tests/",
336   "dom/u2f/tests/",
337   "dom/url/tests/",
338   "dom/webauthn/tests/",
339   "dom/websocket/tests/",
340   "dom/workers/test/",
341   "dom/worklet/tests/",
342   "dom/xhr/tests/",
343   "dom/xml/test/",
344   "dom/xul/test/",
345   "editor/composer/test/",
346   "editor/libeditor/tests/",
347   "editor/spellchecker/tests/",
348   "extensions/permissions/test/",
349   "gfx/layers/apz/test/mochitest/",
350   "image/test/mochitest/",
351   "intl/uconv/tests/",
352   "layout/base/tests/",
353   "layout/forms/test/",
354   "layout/generic/test/",
355   "layout/inspector/tests/",
356   "layout/mathml/tests/",
357   "layout/style/test/",
358   "layout/svg/tests/",
359   "layout/tables/test/",
360   "layout/xul/test/",
361   "parser/htmlparser/tests/mochitest/",
362   "services/sync/tests/tps/",
363   "testing/mochitest/baselinecoverage/plain/",
364   "testing/mochitest/tests/python/files/",
365   "toolkit/components/alerts/test/",
366   "toolkit/components/passwordmgr/test/mochitest/",
367   "toolkit/components/prompts/test/",
368   "toolkit/components/satchel/test/",
369   "toolkit/components/url-classifier/tests/mochitest/",
370   "toolkit/components/windowcreator/test/",
371   "toolkit/components/windowwatcher/test/",
372   "toolkit/content/tests/widgets/",
373   "toolkit/xre/test/",
374   "uriloader/exthandler/tests/mochitest/",
375   "widget/tests/",
378 // Please DO NOT add more entries to the list below.
379 // Doing so may cause conflicts in ESLint rules and globals, and cause
380 // unexpected issues to be raised or missed.
381 let expectedDupePaths = new Set([
382   "caps/tests/mochitest/",
383   "docshell/test/navigation/",
384   "dom/base/test/",
385   "dom/battery/test/",
386   "dom/bindings/test/",
387   "dom/broadcastchannel/tests/",
388   "dom/console/tests/",
389   "dom/encoding/test/",
390   "dom/events/test/",
391   "dom/file/tests/",
392   "dom/indexedDB/test/",
393   "dom/ipc/tests/",
394   "dom/localstorage/test/",
395   "dom/html/test/",
396   "dom/html/test/forms/",
397   "dom/manifest/test/",
398   "dom/messagechannel/tests/",
399   "dom/midi/tests/",
400   "dom/network/tests/",
401   "dom/payments/test/",
402   "dom/plugins/test/mochitest/",
403   "dom/promise/tests/",
404   "dom/reporting/tests/",
405   "dom/security/test/general/",
406   "dom/security/test/https-only/",
407   "dom/security/test/referrer-policy/",
408   "dom/security/test/sec-fetch/",
409   "dom/serviceworkers/test/",
410   "dom/system/tests/",
411   "dom/url/tests/",
412   "dom/websocket/tests/",
413   "dom/workers/test/",
414   "dom/xhr/tests/",
415   "dom/xul/test/",
416   "editor/composer/test/",
417   "editor/libeditor/tests/",
418   "extensions/permissions/test/",
419   "gfx/layers/apz/test/mochitest/",
420   "image/test/mochitest/",
421   "layout/base/tests/",
422   "layout/forms/test/",
423   "layout/generic/test/",
424   "layout/mathml/tests/",
425   "layout/style/test/",
426   "layout/svg/tests/",
427   "layout/xul/test/",
428   "parser/htmlparser/tests/mochitest/",
429   "testing/mochitest/tests/python/files/",
430   "toolkit/components/alerts/test/",
431   "toolkit/components/printing/tests/",
432   "toolkit/components/thumbnails/test/",
433   "toolkit/components/url-classifier/tests/mochitest/",
434   "toolkit/components/windowcreator/test/",
435   "toolkit/components/windowwatcher/test/",
436   "toolkit/content/tests/widgets/",
437   "toolkit/xre/test/",
438   "uriloader/exthandler/tests/mochitest/",
439   "widget/tests/",
441 // Please DO NOT add more paths to the list above.
443 let paths = new Set(extraXpcshellTestPaths);
444 for (let path of [
445   ...extraBrowserTestPaths,
446   ...extraChromeTestPaths,
447   ...extraMochitestTestPaths,
448 ]) {
449   if (paths.has(path) && !expectedDupePaths.has(path)) {
450     throw new Error(`
451 Unexpected directory containing different test types: ${path}
453 Please do not add new paths containing different test types. Please use
454 separate directories.
456 Having different test types in the same directory may cause ESLint rules to be
457 incorrectly applied.
459   }
460   paths.add(path);
463 module.exports = {
464   testPaths: {
465     browser: [...browserTestPaths, ...extraBrowserTestPaths],
466     chrome: [...chromeTestPaths, ...extraChromeTestPaths],
467     mochitest: [...mochitestTestPaths, ...extraMochitestTestPaths],
468     xpcshell: [...xpcshellTestPaths, ...extraXpcshellTestPaths],
469   },