Usage

Inspect messages logged by a component.

tsx
// 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/);
});

Type declaration

ts
export interface LogEntry {
  level: string;
  message: string;
}

Members 2

NameTypeRequiredDescription
levelstringYes—
messagestringYes—
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.