Skip to main content
niceeval/expect provides only pure Match factories. A Match compares one candidate value; it does not record a result or decide a Verdict or score. t.check(value, match) reads value and registers an Assertion immediately. The returned handle only configures that same entry.

How to use it

Matchers

The signature and description for every matcher below are generated from the niceeval/expect source and stay in sync with the current implementation.

and

or

not

includes

excludes

pattern

similarity

Normalized Levenshtein similarity. It is a continuous score and carries no default threshold or Verdict policy.

includesUrl

A plain-text matcher that requires at least min distinct http(s) URLs.

hasSections

A plain-text matcher that requires at least min Markdown headings.

isDefined

isTrue

A refinement matcher for value === true.

isFalse

A refinement matcher for value === false.

commandSucceeded

A matcher for CommandResult-like candidates whose exitCode === 0. It does not read stdout or stderr.

equals

matches

satisfies

defineValueMatch

defineScoreMatch

eventMatch

Match tool calls

ToolMatch compares one logical tool occurrence. It owns occurrence quantifiers such as .exactly(n) and .atLeast(n). Pass a name, an unquantified ToolMatch, or a positive quantified Match to calledTool. notCalledTool uses an unquantified selector to express zero matches.
Use jsonMatch for ordinary JSON, referencesAnyPath for paths, and commandMatch for command tokens. When output is absent, material is incomplete, or HITL has not finished, a Match becomes unavailable; it does not pretend to be an ordinary mismatch. For complete signatures, material states, and three-valued counting rules, see Scoped assertions.

Common usage examples

Composition and three states

Matches within the same and / or must belong to the same domain. The internal result of a Boolean Match is matched, mismatched, or unavailable. or returns unavailable only when no child matches and at least one child’s evidence is incomplete; it does not treat an unknown result as a negative one. A Match itself has no Verdict, score, or control flow. ScoreMatch.atLeast(n) forms a threshold before registration. .score(n), parameterless .gate(), and .orStop() belong to the registered AssertionHandle. The following lists stable fields on Match values themselves. Brands and evaluators are module-private implementation details, not author API.

Match

domain

name

BooleanMatch

kind

[matchRefinementBrand]

ScoreMatch

kind

atLeast

Custom matchers

Use defineValueMatch for a custom Boolean Match and defineScoreMatch for a continuous score. Both compare only one candidate. Reading files, scanning events, deciding coverage, and changing a Verdict remain the responsibility of Assertion registration entry points and the Runner.