Skip to content

test(config): port env-var config tests to it.instance#28706

Merged
kitlangton merged 1 commit into
devfrom
worktree-port-config-tests
May 21, 2026
Merged

test(config): port env-var config tests to it.instance#28706
kitlangton merged 1 commit into
devfrom
worktree-port-config-tests

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

Ports the 5 OPENCODE_DISABLE_PROJECT_CONFIG tests + 1 OPENCODE_PERMISSION test + 2 OPENCODE_CONFIG_CONTENT tests off the `try/finally + withTestInstance` Promise-style pattern onto `it.instance + withProcessEnv`.

Also extends the existing `withProcessEnv` helper to accept `undefined` so a test can scope an "unset this env var" change.

What's NOT ported (deliberately)

The remaining ~33 raw `test()` calls in this file legitimately stay raw:

  • pure unit tests (`parseManagedPlist`, `resolvePluginSpec`, `deduplicatePluginOrigins`, parser tests) — no service composition
  • per-test custom layers (fake Auth/Account variants) — `testEffect(layer)` doesn't support per-test layer overrides
  • nested `tmp/project/.opencode/` directory structures that don't fit the single-tmpdir `it.instance` harness

Test plan

  • `bun run typecheck` clean
  • `bun run test test/config/config.test.ts` — 84/84 pass
  • CI green

Move the OPENCODE_DISABLE_PROJECT_CONFIG, OPENCODE_PERMISSION, and
OPENCODE_CONFIG_CONTENT tests off the try/finally + withTestInstance
Promise-style pattern onto it.instance + withProcessEnv. The remaining
raw test() calls in this file legitimately need to be raw — pure-logic
unit tests (parseManagedPlist, resolvePluginSpec, deduplicatePluginOrigins)
and tests with per-test custom layers or nested project/.opencode/
directory structures that don't fit the single-tmpdir testEffect harness.

Also extends the existing withProcessEnv helper to accept undefined,
so a test can scope an "unset this env var" change in addition to
"set this env var to X".

Net: -142 lines, 8 tests ported, all 84 tests in the file still pass.
@kitlangton kitlangton enabled auto-merge (squash) May 21, 2026 19:06
@kitlangton kitlangton force-pushed the worktree-port-config-tests branch from 9a6bbc2 to 7027400 Compare May 21, 2026 19:06
@kitlangton kitlangton merged commit 231689c into dev May 21, 2026
10 checks passed
@kitlangton kitlangton deleted the worktree-port-config-tests branch May 21, 2026 19:17
MyNameIsGMLi pushed a commit to MyNameIsGMLi/opencode that referenced this pull request May 22, 2026
rustybret pushed a commit to rustybret/opencode that referenced this pull request May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant