Closed Bug 1784699 Opened 3 years ago Closed 3 years ago

ESLint xpcshell test environment should not use the browser environment

Categories

(Developer Infrastructure :: Lint and Formatting, task, P2)

Tracking

(firefox105 fixed)

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(9 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

ESlint's current set-up for xpcshell-tests has the browser environment enabled for that configuration.

This means that items like window, top, name are defined as available in xpcshell-tests, even though they aren't. This hides various bugs, e.g. bug 1784698 and bug 1784697.

As the browser environment is inherited from the main configuration, we need to explicitly turn it off for xpcshell-tests. We can use the priviledged environment for most of the globals that are available to xpcshell.

Attachment #9289801 - Attachment description: Bug 1784699 - Ignore ESLint no-undef warnings in xpcshell-tests where tests are defining WebExtension background scripts. r?arai → Bug 1784699 - Ignore ESLint no-undef warnings in xpcshell-tests where functions are processed in other scopes. r?arai
Attachment #9289803 - Attachment description: Bug 1784699 - Add Readable/WriteableStream realted globals to the list of privileged globals for ESLint. r?arai → Bug 1784699 - Add Readable/WriteableStream related globals to the list of privileged globals for ESLint. r?arai
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9cb6ae0b0a6a Correct globals for PAC tests and clarify where they are obtained. r=necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/b93e9f9ddaf8 Ignore ESLint no-undef warnings in xpcshell-tests where functions are processed in other scopes. r=arai,necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/fc8e6a61aa51 Add more ESLint worker annotations to test files. r=arai https://hg.mozilla.org/integration/autoland/rev/afe3ecd91af3 Add Readable/WriteableStream related globals to the list of privileged globals for ESLint. r=arai https://hg.mozilla.org/integration/autoland/rev/5c0c85ccff5b Add some more globals to ESLint xpcshell environment. r=arai,application-update-reviewers,bytesized https://hg.mozilla.org/integration/autoland/rev/ec16c2001460 Move the ESLint Intl definition across to the privileged environment as it fits better there. r=arai https://hg.mozilla.org/integration/autoland/rev/244de9031beb Add WebAssembly to the ESLint list of privileged globals. r=arai https://hg.mozilla.org/integration/autoland/rev/fd501b7a23c3 Turn off the ESLint browser environment for xpcshell-tests for better represetation of the globals actually available. r=arai

Re-enables the browser environment in WebExtensions tests (as in the m-c patch) and in alertTestUtils.js lists alert, confirm, and prompt as globals because they're likely to be defined by the test.

Pushed by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/9dbbedf44c62 Port Bug 1784699 - Turn off the ESLint browser environment for xpcshell-tests. r=#thunderbird-reviewers,mkmelin

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: