test(config): port env-var config tests to it.instance#28706
Merged
Conversation
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.
9a6bbc2 to
7027400
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Test plan