- Remove the unused `test` helper: `eslint` fails this file with
no-unused-vars ("'test' is defined but never used", exit 1).
- Print `Results: Passed: N, Failed: N`. tests/run-all.js parses those tokens
for repository-wide totals, so the suite previously contributed 0 tests.
- Remove the generated temp plugin directory after each import instead of
leaving an `ecc-plugin-contract-*` directory per run.
node tests/opencode-plugin-loader-contract.test.js -> Results: Passed: 3, Failed: 0
node tests/run-all.js opencode-plugin-loader-contract -> Total Tests: 3, Passed: 3
npx eslint on all six changed files -> 0 errors
The inert stub written when hook consent is not granted was
`export default async () => ({})`. OpenCode v2 validates every plugin
module before running it and requires the default export to be a definition
object with an `id` and an `effect` or `setup` function, so a declined or
runtime-less home install printed the same startup error as the V1 hook
plugin:
PluginModule.LoadError: Plugin must export a default definition with an id
and an effect or setup function.
(cause: SchemaError(Expected object at ["default"]))
Write `export default { id: "ecc-hooks", setup() {} }` instead. It keeps the
inert behaviour (no imports, no module initialization of the replaced
plugin) and satisfies the loader.
Tests that pinned the generated bytes now compare against
getDisabledOpenCodePluginContent() rather than a duplicated literal, and
tests/opencode-plugin-loader-contract.test.js asserts the loader contract on
the generated payload. That test fails on the previous stub
("default export must be an object, got function").
Refs #3537. The same assertion should cover .opencode/plugins/*.ts once a V2
entrypoint lands (#3536, #3224); those plugins are scanned independently in
home installs, so both the barrel and the implementation are loaded.