forge-test-harness 0.1.11

Test harness for OpenAPI Forge plugin authors
Documentation

forge-test-harness

Test harness for OpenAPI Forge plugin authors.

This is the only supported integration-test path for plugins. It builds the plugin's .wasm (delegating invalidation to cargo) and loads it through the same wasmtime-based [forge-host] runtime the production CLI uses. There is no native shim — see ADR-0004.

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 runs cargo build --release --target wasm32-wasip2 on the plugin's manifest dir. Subsequent runs reuse cargo's incremental cache; the inner-loop cycle is fast in practice.

PluginRunner::load(wasm_path) skips the build step if you already have a .wasm artifact.

License

Dual-licensed under Apache-2.0 or MIT at your option.