test(provider): avoid plugin dependency install timeout (#24416)
This commit is contained in:
@@ -55,6 +55,14 @@ async function defaultModel() {
|
|||||||
return run((provider) => provider.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>>) {
|
function paid(providers: Awaited<ReturnType<typeof list>>) {
|
||||||
const item = providers[ProviderID.make("opencode")]
|
const item = providers[ProviderID.make("opencode")]
|
||||||
expect(item).toBeDefined()
|
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 () => {
|
test("plugin config providers persist after instance dispose", async () => {
|
||||||
await using tmp = await tmpdir({
|
await using tmp = await tmpdir({
|
||||||
init: async (dir) => {
|
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 mkdir(root, { recursive: true })
|
||||||
|
await markPluginDependenciesReady(configDir)
|
||||||
|
await markPluginDependenciesReady(Global.Path.config)
|
||||||
await Bun.write(
|
await Bun.write(
|
||||||
path.join(root, "demo-provider.ts"),
|
path.join(root, "demo-provider.ts"),
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user