diff --git a/lib/utils/index.ts b/lib/utils/index.ts index d08c3b52..adaef168 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -83,6 +83,7 @@ const TESTING_FRAMEWORK_SETUP_HOOKS = ['beforeEach', 'beforeAll']; const PROPERTIES_RETURNING_NODES = [ 'activeElement', 'children', + 'childElementCount', 'firstChild', 'firstElementChild', 'fullscreenElement', diff --git a/tests/lib/rules/no-node-access.test.ts b/tests/lib/rules/no-node-access.test.ts index 43981e21..e4d81a6b 100644 --- a/tests/lib/rules/no-node-access.test.ts +++ b/tests/lib/rules/no-node-access.test.ts @@ -324,5 +324,22 @@ ruleTester.run(RULE_NAME, rule, { }, ], }, + { + code: ` + import { render } from '${testingFramework}'; + + const { container } = render() + + expect(container.childElementCount).toBe(2) + `, + errors: [ + { + // error points to `childElementCount` + line: 6, + column: 26, + messageId: 'noNodeAccess', + }, + ], + }, ]), });