Skip to content

cleanup

All disposers created by mountScene and createTestRoot are registered with a global registry. Wire cleanup() into your test framework's lifecycle to run them automatically:

import { afterEach } from "vitest";
import { cleanup } from "pixi-solid/testing";
afterEach(() => cleanup());

Once wired, you no longer need to track dispose:

it("some test", () => {
mountScene(() => <Container label="root" />);
// cleanup runs automatically in afterEach
});

To disable automatic cleanup for a specific test, call dispose() directly:

const { dispose } = mountScene(() => <Container />);
// ... test logic ...
dispose();