eslint-plugin-testing-library: prefer-wait-for: Cannot read property 'arguments' of null
Hello, prefer-wait-for
rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. ESlint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.
https://github.com/AriPerkkio/eslint-remote-tester/runs/1551964310?check_suite_focus=true
Complete list of dependencies and .eslintrc
is available at CI runs logs, steps Run yarn list | grep eslint
and Run yarn log --config ./plugin-configs/eslint-plugin-testing-library.config.js
.
eslint-plugin-testing-library@3.10.1
rules: {
'testing-library/prefer-wait-for': 'error',
}
Minimal repro:
import { waitForElement } from '@testing-library/react';
global.waitForElement = waitForElement;
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:2
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
Crash reports from real projects
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:2
- Path:
diondirza/rexr/test/test-utils.js
- Link
import React from 'react';
import { fireEvent, render, waitForElement } from '@testing-library/react';
import { HelmetProvider } from 'react-helmet-async';
import { Router } from 'react-router-dom';
import { createBrowserHistory } from 'history';
import { GlobalProvider } from '@context';
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:2
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:18
- Path:
gravitational/webapps/packages/design/src/utils/testing.tsx
- Link
* limitations under the License.
*/
import React from 'react';
import {
render as testingRender,
act,
fireEvent,
waitForElement,
} from '@testing-library/react';
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:18
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:2
- Path:
faultable/wardex/src/setupTests.js
- Link
import React from 'react'
import {
afterEach,
render,
cleanup,
fireEvent,
wait,
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:2
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:2
- Path:
activewidgets/react/test/adapter/react.js
- Link
import {render, fireEvent, wait, waitForElement} from '@testing-library/react';
import {h} from '@activewidgets/components';
export function mount(component, props){
return render(h(component, props));
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:2
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:3
- Path:
w-sr/React-Storybook-Game/src/setupTests.js
- Link
import React from 'react';
import '@testing-library/jest-dom/extend-expect';
import { render, fireEvent, waitForElement } from '@testing-library/react';
import renderer from 'react-test-renderer';
import sinon from 'sinon';
import { act } from 'react-dom/test-utils';
import 'jest-styled-components';
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:3
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
Rule: prefer-wait-for
- Message:
Cannot read property 'arguments' of null Occurred while linting <text>:20
- Path:
sumup-oss/circuit-ui/src/util/test-utils.tsx
- Link
import React, { FunctionComponent } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import '@testing-library/jest-dom/extend-expect';
import { configureAxe } from 'jest-axe';
import {
render as renderTest,
wait,
act,
RenderResult,
} from '@testing-library/react';
TypeError: Cannot read property 'arguments' of null Occurred while linting <text>:20
at Object.fix (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:61:50)
at normalizeFixes (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:178:28)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:920:41)
at reportWait (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:53:21)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:97:36
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:96:52
at Array.forEach (<anonymous>)
at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/prefer-wait-for.js:95:26
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (17 by maintainers)
Congratulations about v4! 🎉
I was excited to see how it stands against heavy 6 hour tests - and it was perfect score with 0 crashes. It was so fast that I’m even suspecting I’ve misconfigured the
eslintrc
😄.[eslint-plugin-testing-library]: Repositories (14024/14496)
Here are some comparisons from other plugins. The results are not 100% comparable but it provides some useful feedback about plugin’s performance.
Definitely!
If you are interested in keeping
master
branch of this repository stable I could help by setting up PR whereeslint-remote-tester
would be run in this repository. Some ESLint plugins are already doing this. See https://github.com/marketplace/actions/eslint-remote-tester-runner.Awesome! I think I’m gonna leave it open as I did with other issues solved on v4 until it gets released.
@AriPerkkio We can start with the weekly triggered tests on your repo for now and maybe manually putting all errors in an issue here I think.
We can discuss this maybe even further in an issue/discussion on your repo so we don’t hijack this issue any further?
Thanks for your help @AriPerkkio! I’ll include the badge in the following days. Probably we can move the reporting from
eslint-remote-tester
to a new discussion.Good points @MichaelDeBoey. Let’s keep running the tests in
eslint-remote-tester
repository and check if the bot could post results in this project.I would imagine something like
repository-for-results: testing-library/eslint-plugin-testing-library
option foreslint-remote-tester-run-action
setup. And possibly some other fields for selecting/authenticating the bot.It would be interesting to run this check to have some insights about the plugin, but we shouldn’t block any package release because of this check.
@AriPerkkio Since this package is using
semantic-release
, everything that’s pushed tomain
will also be released.Running these smoke tests in this repo will also result in a 6 hour run for each push to
main
.We would also have to update/maintain the
repositories.json
&eslint-remote-tester.config.js
files ourselves, which will become outdated really quickly with what you have in your repo.Since you’re already doing all this hard work, I think we could all benefit (not only this repo, but all the other ESLint plugins too) from that work without doing it twice.
Thanks for the verification @Belco90. Feel free to close this issue.
Once v4 is available in npm I’ll include it to my weekly scheduled CI runs on eslint-remote-tester.