Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

toBeOneTrace

Every span belongs to one trace, with one root.

Passes when every span belongs to one trace and exactly one of them is a root (a span whose parent is not among them): the browser’s and the server’s spans of one turn joined up. No spans at all fails. It reads what toHaveSpan reads; a failure names the traces, or the roots.

Import

import "@webmcp-agents/testing/matchers"; // in setupFiles (the main entry and ./setup register them too)

Example

expect([...browser.spans, ...server.spans]).toBeOneTrace();

Options

expect(received).toBeOneTrace().

Name Type Default Description
received the value under test required What expect(…) was given; the matcher takes no arguments.

Returns

Nothing: it passes, or fails the test with a message that says what happened.

See also

Was this page helpful?