import { t as debug_default } from "./debug-cDi3H0Pi.js";
import { getActiveTest } from "@japa/runner";
import { TestContext } from "@japa/runner/core";
function extendSwap(container) {
	debug_default("extending japa context with container swap method");
	TestContext.macro("swap", function(binding, fake) {
		const activeTest = getActiveTest();
		if (!activeTest) throw new Error("Cannot use \"swap\" outside of a Japa test");
		container.swap(binding, typeof fake === "function" ? fake : () => fake);
		activeTest.cleanup(() => container.restore(binding));
		return fake;
	});
}
function useFake(binding, fake) {
	const activeTest = getActiveTest();
	if (!activeTest) throw new Error("Cannot use \"useFake\" outside of a Japa test");
	return activeTest.context.swap(binding, fake);
}
export { useFake as n, extendSwap as t };
