MCPcopy Create free account
hub / github.com/mksglu/context-mode / createTestPlugin

Function createTestPlugin

tests/opencode-plugin.test.ts:24–39  ·  view source on GitHub ↗

* Create a plugin instance with DB in a temp directory. * Uses dynamic import to resolve routing module from project root.

(tempDir: string)

Source from the content-addressed store, hash-verified

22 * Uses dynamic import to resolve routing module from project root.
23 */
24async function createTestPlugin(tempDir: string) {
25 // Import the plugin module
26 const { ContextModePlugin } = await import("../src/adapters/opencode/plugin.js");
27
28 // Monkey-patch the session dir to use temp directory
29 // The plugin uses homedir() internally, but we can control the DB path
30 // by creating the plugin with a unique directory that produces a unique hash
31 return ContextModePlugin({
32 directory: tempDir,
33 client: {
34 app: {
35 log: async () => {},
36 },
37 },
38 });
39}
40
41// ── Tests ─────────────────────────────────────────────────
42

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected