pub fn js_ts_generate_tests<'a, F, M>(
modules: &'a [(&'a AIRModule, &'a Path)],
framework: &str,
file_ext: &str,
import_ext: &str,
output_path: F,
make_emitter: M,
) -> Result<TestArtifacts, CodegenError>Expand description
Build the Vitest/Jest test file for the project’s @test functions (S7),
shared by the JS and TS backends (identical apart from the file extension and
the concrete emit context, both injected by the caller).
framework:"jest"→ Jest globals; anything else → Vitest import.file_ext: the test file’s own extension ("js"/"ts").import_ext: the extension to use in import specifiers. For JS this is"js"; for TS it is also"js"— TS/ESM specifiers reference the emitted.js, whichtsc’s.js→.tsresolution follows (and a stricttsc --noEmitrejects a.tsspecifier withoutallowImportingTsExtensions).output_path: maps a module to its emitted file path (entry →main.<ext>).make_emitter: builds the per-program expression emitter (with the same cross-module registries the runtime tree uses).
Imports each module’s public functions by name and lowers
expect(actual).<assertion>(expected) chains to the framework’s matcher API.
Returns a single bock.test.<file_ext> file (no entry wiring).
§Errors
Propagates CodegenError from expression lowering.