Closed Bug 1514720 Opened 6 years ago Closed 6 years ago

Fix ESLint 'Illegal usage of jasmine global' warnings

Categories

(Tree Management :: Treeherder: Frontend, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

After bug 1364045 some jest ESLint plugin warnings can be seen locally and on Travis, eg: warning: Illegal usage of jasmine global (jest/no-jasmine-globals) at tests/ui/unit/context/pushes.tests.jsx:15:5: 13 | 14 | beforeEach(() => { > 15 | jasmine.getJSONFixtures().fixturesPath = 'base/tests/ui/mock'; | ^ 16 | 17 | fetchMock.get( 18 | getProjectUrl('/resultset/?full=true&count=10', repoName), (https://travis-ci.org/mozilla/treeherder/jobs/468980888#L207) The reason these don't cause `yarn lint` to fail, is that by default ESLint does not exit non-zero for warnings, only errors. We should fix these warnings and then use the `--max-warnings` option to make them fatal during `yarn lint`. See: https://eslint.org/docs/user-guide/command-line-interface
Commits pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/0009e7fa5029bd2d2cc33067abf3befc4d54d6e2 Bug 1514720 - Stop using jasmine-jquery JSON fixtures support Since it's unnecessary given that we now have the ability to import JSON directly, and the current usage is causing ESLint warnings like: ``` warning: Illegal usage of jasmine global (jest/no-jasmine-globals) at tests/ui/unit/context/pushes.tests.jsx:15:5: 13 | 14 | beforeEach(() => { > 15 | jasmine.getJSONFixtures().fixturesPath = 'base/tests/ui/mock'; | ^ 16 | 17 | fetchMock.get( 18 | getProjectUrl('/resultset/?full=true&count=10', repoName), ``` This means the only `jasmine-jquery` feature we're now using is the `toHaveLength` matcher, so use of `jasmine-jquery` can be dropped entirely once the tests are migrated to Jest, which supports `toHaveLength` natively. https://github.com/mozilla/treeherder/commit/9821dc51b1971a0a52e030a846ae6c747c43f9bf Bug 1514720 - Make ESLint warnings fatal when running yarn lint Since otherwise any rules marked as level `warning` do not cause ESLint to exit with a non-zero exit code.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: