Skip to content
weftGitHub

Diagnostics

T006

Mocking weft (vi.mock('@weft-js/core')) or the unit under test, so the test checks the mock.

Fix: Fake the edges (network, storage) and render the real component.

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'vi.mock('./Cart')test('cart', () => { render(Cart); expect(document.body.textContent).toBe('') })

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

More: weft docs testing.