Skip to content
weftGitHub

Diagnostics

T005

Implementation query: container, CSS selectors, classes, innerHTML, test ids, or app state read directly in a component test.

Fix: Query by role, label or text (screen.getByRole, getByLabelText, getByText).

Status in weft@0.1.0: reported by weft check on test files.

Triggers it:

tsx
import { render } from '@weft-js/core/test'import { Cart } from './Cart'test('total', () => { const { container } = render(Cart); expect(container.querySelector('.total')!.textContent).toBe('$0') })

A test that needs it on purpose keeps it with a reason: // weft-allow T005: <why> in the file header (whole file) or on the line above.

More: weft docs testing.