~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/atlibs

0
0
main
14 lines · 673 B Raw History
// node --import ./rust/host/swap.mjs --test <suites>: 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;
	},
});