Skip to content

Testing ​

bash
pnpm test            # everything
pnpm test:coverage   # with enforced thresholds (core and interpreter ≥ 95% lines)
pnpm eval            # evaluation report

Layers ​

LayerWhat it provesWhere
UnitEvery module in isolation: schema rules, validator coercion, mutations, normalizer, date math (DST included), executor, mentions, parser grammar (140+ phrases), providers against recorded HTTP responses, server status mappingpackages/*/src/**/*.test.ts
Property-basedFor any input (grammar-shaped, arbitrary Unicode, multi-step sessions, arbitrary or plausible-but-wrong model JSON), interpret() never throws, ok queries are valid, and nothing references a hidden or unknown fieldpackages/interpreter/src/robustness.test.ts, core property tests
AdversarialPrompt injection against a model that obeys it; nothing escapes the schemarobustness suite, benchmark adversarial cases
Adapter conformanceAdapters reproduce the reference executor's rows and order exactly@avinash-baraiya/pragma-conformance, packages/tanstack/src/conformance.test.ts
IntegrationReal SDKs over stubbed transports (Anthropic SDK, AI SDK generateText), a real node:http server, React components with user-event and axe accessibility checksproviders, server, react tests
Evaluation gateLabelled dataset: deterministic cases must match exactly; semantic, unsupported and adversarial cases must be declined without a modelbenchmarks/

Adapter conformance ​

@avinash-baraiya/pragma-conformance provides a seeded 120-row dataset (nulls, mixed case, Unicode, ties, dates near timezone boundaries) and 49 named queries covering every operator, nested AND/OR/NOT groups, search, multi-key sorting with nulls, and page/offset pagination. To certify a new adapter (SQL builder, Elasticsearch, AG Grid, …):

ts
import {
  conformanceCases,
  conformanceDataset,
  referenceIds,
} from '@avinash-baraiya/pragma-conformance';

for (const testCase of conformanceCases) {
  it(testCase.name, async () => {
    expect(await myAdapter(conformanceDataset, testCase.query)).toEqual(referenceIds(testCase));
  });
}

Evaluation ​

benchmarks/dataset/customers.jsonl holds labelled instructions with their expected status, explanation, ambiguity kind or error code, and a route:

  • deterministic — the parser must match exactly;
  • model — needs semantic understanding; the parser must decline;
  • refuse — unsupported or adversarial; nothing may produce a query.

Add a case for every bug you fix and every phrasing users report.

Released under the MIT License.