Expand description
Test-harness generation: suite/test integration processing, the test entry
(tests/main.ts), the discovery manifest and the embedded test-runtime fragments. The
fragments are authored as modules under bynk-emit/runtime/src/testing/ and reach the harness
only through runtime_splice (1B.3a, #4047).
1B.2a (#4028, ADR “Where test generation lives”): moved here from the driver’s
project/tests_emit{.rs,/}, beside emitter. It reads no file, spawns no process and holds
no thread-local; the driver keeps orchestration, file I/O and running the tests, and calls
process_tests, process_integration_tests, discovery_manifest and
emit_test_main. Production output never lives here: the commons barrel is
emitter::commons_barrel.
P5.4 (design/tracks/semantics-in-the-checker.md §6): the checking half
of process_tests/process_integration_tests — target/participant
resolution, duplicate-case-name detection, stub-clause resolution, and
case/property body type-checking — relocated to
bynk_check::test_suites (as test_suites::phase_test_bodies/
test_suites::phase_integration_bodies), shared with
bynk_check::analysis::analyse_project so a .bynk test file gets
diagnostics and RefSink bindings (go-to-definition/find-references)
through the LSP again, closing category 7 of
bynk-check/src/analysis.rs‘s own residual-gap accounting — the last of
the seven. This file keeps both functions’ exact signatures (run_checks
needs no change) and everything Phase 5 (TypeScript emission) needs: the
two functions now call the relocated checking phase first, then emit only
for what it returns as ready. Several functions the checking phase needs
are genuinely dual-use — also needed here to lower a checked body to
TypeScript — and stayed pub in bynk_check::test_suites rather than
being duplicated; every call into that module below is qualified
(test_suites::foo(...)) for exactly that reason (see that module’s own
doc comment for the full accounting).
Structs§
- Integration
D1 - P5.4:
test integration "name"suite processing. Validates thewiresparticipant set (existence, ≥ 2, no duplicates, fullconsumesclosure), type-checks each case body as a cross-context call from a synthetic harness root that consumes every participant, and emits a TypeScript module that stands the participants up as in-process Workers wired by simulated Service Bindings and runs the cases across the real serialise/deserialise wire. The checking half (participant inference, thesystem-needs-a-serialisation-edge gate, duplicate-case-name detection, the harness cross-context view, and per-case body type-checking) now lives intest_suites::phase_integration_bodies, which hands back each ready group’s harnessresolver::CrossContextInfo— the one piece worth not recomputing here (built from clone-heavy maps).participants/uses_targets/case_inputsare cheap and pure, so the loop below recomputes them exactly as this function always did, using the now-relocatedtest_suites::infer_participants. TheD1inputs an integration suite is processed with: each database’s migrations, run on every test database (P4b, #2608), and the schemas they build, which aD1.peekread in a case is prepared against (#3147;Noneunder[check] d1_sql = false). - Runnable
Test - Discovered, named test ready to be invoked from the top-level runner.
- Test
Asset Files - #1883, slice 3: the project’s declared assets, for the test passes — each
declaration’s served path (
bynk_check::assets::declared_served_paths) and each declared file’s bytes. Empty when noassets/folder was read.
Constants§
- EVAL_
CASE - The name of the synthetic case.
bynk-driverlowers a case of this name with its tail reported, and the run selects it by this name. - SMOKE_
SUITE_ SUFFIX - #2685: the tail of the synthesised smoke suite’s file name (
<stem>.smoke.bynk), which a test build reads to name its typed routes to the decoder. - TEST_
SESSION_ KEY - #3386: the fixed signing key a
SignedCookieactor’s key variable takes in a test run (base64url of 32 bytes), as the verifier refuses the shortTEST_SECRET.
Functions§
- discovery_
manifest - v0.67: fold the combined runnable manifest into the discovery suites, ordered
by the runner’s sort key (
target_name) so the discovery document matches a run’s suite order. - emit_
test_ main - process_
integration_ tests - process_
tests - P5.4:
test <target>suite processing. The checking half (target/stubresolution, duplicate-case-name detection, case/property body type-checking — formerly this function’s own Phases 2-4) now lives intest_suites::phase_test_bodies; only a target that passed every gate comes back, keyed by its resolvedstubmap, so the loop below is Phase 5 (TypeScript emission) alone, over exactly the targets ready for it.