tests.LogEntry
A log line the app or the runtime wrote.
Utilização
Inspect messages logged by a component.
// Inspect messages logged by a component.
import { onMount } from 'kuito';
import { assert, render, test, type LogEntry } from 'kuito/tests';
function Legacy() {
onMount(() => console.warn('Legacy is deprecated: use Modern'));
return null;
}
const warnings = (logs: readonly LogEntry[]) => logs.filter((entry) => entry.level === 'warn');
test('mounting Legacy warns once', async () => {
const app = await render(<Legacy />);
assert.equal(warnings(app.logs).length, 1);
assert.match(warnings(app.logs)[0]?.message ?? '', /deprecated/);
});Declaração do tipo
export interface LogEntry {
level: string;
message: string;
}Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
level | string | Sim | — |
message | string | Sim | — |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.