// node --import ./rust/host/swap.mjs --test : every import of javascript/src/run-module // resolves to rust/host/conformance.mjs, so runModule (and everything built on them: // harness handle(), runCompose) run on the Rust engine while the suites' assertions stay as written. import { registerHooks } from "node:module"; const TARGET = new URL("../../javascript/src/run-module/index.js", import.meta.url).href; const SWAPPED = new URL("./conformance.mjs", import.meta.url).href; registerHooks({ resolve(specifier, context, next) { const resolved = next(specifier, context); return resolved.url === TARGET ? { ...resolved, url: SWAPPED } : resolved; }, });