Repository navigation
test: make safe-teardown suite hermetic like the other suites - #122
Merged
Merged
Conversation
test/safe-teardown.test.js was the only suite that did not scrub OPENCODE_LLM_PROXY_* variables from the environment before each test. With a developer/CI shell that exports a token (OPENCODE_LLM_PROXY_TOKEN) every request in the suite got a 401, so seven tests failed for reasons unrelated to the code under test. Add the same beforeEach scrub used by stream-conformance, http-integration and tool-payload-fidelity. The two tests that need specific values still set them inside their own bodies, i.e. after the hook runs.
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.
Problem
test/safe-teardown.test.jswas the only test suite that did not scrubOPENCODE_LLM_PROXY_*variables from the environment before each test.With a developer or CI shell that exports a token (
OPENCODE_LLM_PROXY_TOKEN), every request in the suite got a 401, so seven tests failed for reasons unrelated to the code under test:Fix
Add the same
beforeEachscrub already used byindex.test.js,test/http-integration.test.js,test/stream-conformance.test.js, andtest/tool-payload-fidelity.test.js.The two tests that need specific values (
OPENCODE_LLM_PROXY_KEEP_SESSIONS,OPENCODE_LLM_PROXY_DELETE_TIMEOUT_MS) set them inside their own bodies, i.e. after the hook runs, so they are unaffected.Verification
npm testwith a token exported in the shell: 326 tests, 326 pass, 0 fail (previously 7 fail, 319 pass).npm run lintclean.