Closed Bug 1331006 Opened 7 years ago Closed 7 years ago

Create a rule to import test globals for mochitest/chrome/browser tests from SimpleTest/EventUtils

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

SimpleTest & EventUtils get used quite a bit in tests. Rather than trying to list all their global values in the *.eslintrc.js files, I've created a rule to import the globals automatically.

This knocks off another 300 no-undef errors off the list.
Also included are some other globals, and missing .eslintrc.js files for new test directories.
Comment on attachment 8826659 [details]
Bug 1331006 - [eslint] Define more globals, and add a rule to import test globals from SimpleTest/EventUtils.

https://reviewboard.mozilla.org/r/104562/#review105718

::: toolkit/components/windowcreator/test/test_nsFind.html:159
(Diff revision 1)
> -  function assertFound(node, searchValue) {
> -    ok(find(node, searchValue), "\"" + searchValue + "\" not found");
> +  function assertFound(node, value) {
> +    ok(find(node, value), "\"" + value + "\" not found");
>    }
>  
> -  function assertNotFound(node, searchValue) {
> -    ok(!find(node, searchValue), "\"" + searchValue + "\" found");
> +  function assertNotFound(node, value) {
> +    ok(!find(node, value), "\"" + value + "\" found");

Why were all these changes necessary?

::: tools/lint/eslint/eslint-plugin-mozilla/lib/rules/import-test-globals.js:34
(Diff revision 1)
> +  // Public
> +  // ---------------------------------------------------------------------------
> +
> +  return {
> +    Program: function(node) {
> +      //

Unnecessary comment?
Attachment #8826659 - Flags: review?(dtownsend) → review+
Comment on attachment 8826659 [details]
Bug 1331006 - [eslint] Define more globals, and add a rule to import test globals from SimpleTest/EventUtils.

https://reviewboard.mozilla.org/r/104562/#review105718

> Why were all these changes necessary?

Mochitests have the "no-shadow" rule enabled. Adding the .eslintrc.js file to the directory triggered the failures.

> Unnecessary comment?

Yep, fixed. I also updated the documentation at the top of the file.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8d4fe24cd664
[eslint] Define more globals, and add a rule to import test globals from SimpleTest/EventUtils. r=mossop
https://hg.mozilla.org/mozilla-central/rev/8d4fe24cd664
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
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: