effectify Plugin service internals (#19365)

This commit is contained in:
Kit Langton
2026-03-27 11:20:11 -04:00
committed by GitHub
parent bb8d2cdd10
commit e528ed5d86
2 changed files with 70 additions and 63 deletions

View File

@@ -64,12 +64,11 @@ describe("plugin.config-hook-error-isolation", () => {
test("config hooks are individually error-isolated in the layer factory", async () => {
const src = await Bun.file(file).text()
// The config hook try/catch lives in the InstanceState factory (layer definition),
// not in init() which now just delegates to the Effect service.
// Each hook's config call is wrapped in Effect.tryPromise with error logging + Effect.ignore
expect(src).toContain("plugin config hook failed")
const pattern =
/for\s*\(const hook of hooks\)\s*\{[\s\S]*?try\s*\{[\s\S]*?\.config\?\.\([\s\S]*?\}\s*catch\s*\(err\)\s*\{[\s\S]*?plugin config hook failed[\s\S]*?\}/
/for\s*\(const hook of hooks\)\s*\{[\s\S]*?Effect\.tryPromise[\s\S]*?\.config\?\.\([\s\S]*?plugin config hook failed[\s\S]*?Effect\.ignore/
expect(pattern.test(src)).toBe(true)
})
})