test(provider): avoid plugin dependency install timeout

This commit is contained in:
Kit Langton 2026-04-25 21:55:59 -04:00
parent 5a4763f560
commit b60294c696

View file

@ -55,6 +55,14 @@ async function defaultModel() {
return run((provider) => provider.defaultModel())
}
async function markPluginDependenciesReady(dir: string) {
await mkdir(path.join(dir, "node_modules"), { recursive: true })
await Bun.write(
path.join(dir, "package-lock.json"),
JSON.stringify({ packages: { "": { dependencies: { "@opencode-ai/plugin": "0.0.0" } } } }),
)
}
function paid(providers: Awaited<ReturnType<typeof list>>) {
const item = providers[ProviderID.make("opencode")]
expect(item).toBeDefined()
@ -2439,8 +2447,11 @@ test("cloudflare-ai-gateway forwards config metadata options", async () => {
test("plugin config providers persist after instance dispose", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
const root = path.join(dir, ".opencode", "plugin")
const configDir = path.join(dir, ".opencode")
const root = path.join(configDir, "plugin")
await mkdir(root, { recursive: true })
await markPluginDependenciesReady(configDir)
await markPluginDependenciesReady(Global.Path.config)
await Bun.write(
path.join(root, "demo-provider.ts"),
[