ESLint jest failures when updating to 23.0.x
Categories
(DevTools :: Debugger, task, P3)
Tracking
(firefox81 fixed)
| Tracking | Status | |
|---|---|---|
| firefox81 | --- | fixed |
People
(Reporter: standard8, Assigned: duncangleeddean, Mentored)
Details
(Keywords: good-first-bug)
Attachments
(1 file)
I'm looking at updating our node modules to the latest versions. When I was running through the updates, updating eslint-plugin-jest caused various errors to be reported.
STR:
$ cd mozilla-central
$ npm install --save-exact --save-dev eslint-plugin-jest@23.8.1
$ ./mach eslint devtools/*
Output:
devtools/client/debugger/packages/devtools-reps/src/reps/tests/event.js
92:3 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/packages/devtools-utils/src/tests/network-request.js
43:7 error Tests should use Jest‘s exception helpers. Use "expect(() => yourFunction()).toThrow()" for synchronous tests, or "await expect(yourFunction()).rejects.toThrow()" for async tests jest/no-try-expect (eslint)
devtools/client/debugger/src/utils/tests/quick-open.spec.js
12:24 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
27:28 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/src/utils/tests/wasm.spec.js
60:5 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/src/workers/parser/tests/framework.spec.js
16:5 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/src/workers/parser/tests/getScopes.spec.js
24:7 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/src/workers/parser/tests/getSymbols.spec.js
19:5 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
devtools/client/debugger/src/workers/parser/utils/tests/ast.spec.js
34:5 error Expect must be inside of a test block. jest/no-standalone-expect (eslint)
Updated•1 year ago
|
Updated•11 months ago
|
| Assignee | ||
Comment 1•10 months ago
|
||
Hey 👋
I’m currently fixing these lint issues. Will submit a patch tomorrow.
Comment 2•10 months ago
|
||
Great, thanks! Assigning to you.
@bomsy, could you please help with the review here?
Honza
| Assignee | ||
Comment 4•10 months ago
|
||
Hi @bomsy :)
Just maybe a question on whether standalone expects should be allowed or not? Are we going to be happy with these checks or must I disable that particular rule?
I've been fixing the issues to comply but maybe that's not the way we wish to go :)
| Assignee | ||
Comment 5•10 months ago
|
||
It looks like the rule jest/no-standalone-expect is also not compatible with jest-in-case's cases. Related issue on GitHub. Which leads me to think that this particular rule might need to be disabled for now unless it's just disabled in the files using cases .
Comment 6•10 months ago
|
||
Hi Duncan,
Yes i think we can turn the rule off in the eslintrc file and add a comment detailing the reason why and links to any useful documentation?
| Assignee | ||
Comment 7•10 months ago
|
||
Currently the jest/no-standalone-expect rule needs to be disabled for jest-in-case cases blocks as it is not compatible.
Pushed by hmanilla@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/df0fd723b0ae Upgrade eslint-plugin-jest and fix new lint errors. r=bomsy,Standard8
Comment 9•9 months ago
|
||
| bugherder | ||
Description
•