-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
bugSomething isn't workingSomething isn't workingtriagePending to be triaged by a maintainerPending to be triaged by a maintainer
Description
Have you read the Troubleshooting section?
Yes
Plugin version
7.6.6
ESLint version
9.33.0
Node.js version
22.12.0
Bug description
When calling user.click(element)
, if the call occurs in an external function and not a test, no-node-access
reports the following error:
Avoid direct Node access. Prefer using the methods from Testing Library.
Steps to reproduce
Create a function that takes user
and element
as params:
export const click = async (user: UserEvent, element: HTMLElement) => {
await user.click(element);
};
You will see that await user.click(element);
flags an error.
Error output/screenshots
Avoid direct Node access. Prefer using the methods from Testing Library.
ESLint configuration
// Testing Library
{
files: ['tests/unit/**/*.{js,ts}'],
...pluginTestingLibrary.configs['flat/vue'],
},
Rule(s) affected
no-node-access
Anything else?
This started in v7.6.6. It was not a problem in v7.6.5.
No issue flagged with the following code within a test, only when this same behavior is extracted to the function copied in Steps to Reproduce.
await user.click(screen.getByRole('button', { name: 'Submit' }));
Do you want to submit a pull request to fix this bug?
No
nickmartin-wwt, patik and Zhangjun-Hex
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriagePending to be triaged by a maintainerPending to be triaged by a maintainer