Expand description
Plugin author test harness.
This is the only supported integration-test path for plugin authors.
See ADR-0004. The harness drives cargo build (when asked) and loads
the resulting .wasm through the same forge-host runtime that
production uses.
§Recommended usage
ⓘ
use forge_test_harness::PluginRunner;
#[test]
fn drops_unwanted_operations() {
let runner = PluginRunner::build_and_load(env!("CARGO_MANIFEST_DIR"))
.unwrap();
let out = runner
.transform(fixture_ir(), serde_json::json!({"keep": ["users"]}))
.unwrap();
assert_eq!(out.spec.operations.len(), 2);
}The first invocation performs cargo build --release --target wasm32-wasip2 for the plugin’s manifest dir. Subsequent runs reuse
cargo’s incremental cache, so the cycle is fast in practice.
The example above is ignored because doctests can’t easily build a
wasm32-wasip2 target on the fly. A smaller, executable doctest on
HarnessError verifies that the published surface is reachable.
Structs§
- Plugin
Runner - Loaded plugin handle, ready to invoke.
Enums§
- Harness
Error - Anything that can go wrong while building or loading a plugin.