Skip to content
  • There are no suggestions because the search field is empty.

Testing the TypeScript SDK

Run npm run check for the strict typecheck, the conformance suites that replay the Python reference's recorded behaviour, and the ESM/CJS build; run the live suites only against a test tenant.

Overview

Relevant for Developers maintaining or extending the SDK

The TypeScript SDK isn't trusted on its own word. The Python reference SDK is verified live against a real tenant and exports conformance vectors: the exact request it sends for every op, its core decisions, and recorded traces of every helper and semantic flow. The TypeScript suites replay all of them and must match byte for byte. A live suite then checks transport, auth and TLS against the tenant.

Run the suites

Relevant for Developers before every commit

npm run check                                     # typecheck + conformance + build
ALERTOPS_DOTENV=path/to/.env npm run test:live # live smoke and semantic blueprint
SuiteFileWhat it proves
Requeststest/requests.test.tsEvery op (802 public + 30 internal) sends Python's exact method, URL, query, auth header and body.
Coretest/core.test.tsError parsing, status → error class, retry decisions, every paginator's page sequence, envelopes and .env parsing.
Flowstest/flows.test.tsAll 247 helper traces: the same requests in the same order, then the same result or error.
Functionstest/functions.test.ts109 pure helpers and the Python semantics they rely on (str(), json.dumps, quote, title case …).
Semantictest/semantic.test.ts58 planner vectors and 35 executor traces.
Drifttest/drift.test.tsThe generated code, the vendored spec and its lock hash agree, and no helper is a stub.
Livetest/live/*.live.tsReal tenant: auth, error mapping, pagination, ingest-to-close, blueprint apply, verify and rollback.

Update after a reference change

Relevant for Developers syncing with the Python reference

  1. In alertops-python, run python tools/export_spec.py (it re-derives sdk-spec/ from the Python SDK).
  2. Run python tools/sync_spec.py (it copies the bundle into every language repo).
  3. Run python tools/codegen/run.py ts (it regenerates src/generated/).
  4. Run npm run check. A failing vector means the TS core or a helper no longer matches Python. Fix it until the suite is green.

Never edit src/generated/
Those files are produced from the spec and carry a DO NOT EDIT header with the spec hash. The drift test fails if they are edited or stale.

Live testing rules

Relevant for Anyone running the live suites

  • Run them only against a test tenant.
  • Every object is named sdktest-…, users are @example.com, and everything is deleted in reverse order, even when a step fails.
  • Leftovers can be listed and removed with alertops-python's python tools/sweep.py --prefix sdktest-ts.

Live coverage

Relevant for Anyone checking how much was verified against the tenant

docs/LIVE_COVERAGE.md classifies every op:

  • live: the TS SDK got a 2xx, from its own live tests or from the cross-language replay of every safe GET the Python suite made.
  • parity: Python got a 2xx live, and TS sends the identical request.
  • exempt: no live 2xx is possible, for a documented reason.

There must be no gaps.

Troubleshooting

Relevant for Anyone whose suite fails

drift.test.ts: vendored sdk-spec matches its lock fails

  • The sdk-spec/ copy was edited or has CRLF line endings. Re-run sync_spec.py. The repo pins LF in .gitattributes.

A flow vector fails with "made more requests than Python"

  • The TS helper calls an extra endpoint, or misses an early return. Compare it line by line with the Python flow named in the vector.

Related Articles

Need help?

Email support@alertops.com or contact your AlertOps representative.