Repository navigation
Stop bundle specs leaking Tap and Cask doubles - #24267
Merged
Merged
Conversation
- `Homebrew::Bundle::Tap.taps` and `Homebrew::Bundle::Cask.casks` memoise whatever `Tap.select` and `Cask::Caskroom.casks` return, so the `instance_double`s stubbed in `tap_spec` and `dumper_spec` survived into later examples. - `npm_spec`'s `Installer.install!` example then hit rspec-mocks' "leaked into another example" error whenever a dumper example ran first in the same process, failing random test orders. Signed-off-by: Patrick Linnane <patrick@linnane.io>
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.
Homebrew::Bundle::Tap.tapsandHomebrew::Bundle::Cask.casksmemoise whateverTap.selectandCask::Caskroom.casksreturn, so theinstance_doubles thattap_specanddumper_specstub into them survive their example and theInstaller.install!example innpm_specfails with rspec-mocks' "leaked into another example" error whenever a dumper example ran first in the same process, astests (no Sorbet)has been doing onmain. Reset the memoised state after each of those examples;brew tests --no-parallel --only=bundle/tap,bundle/npm --seed=1reproduces the failure before this change and passes after it.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Mythos 5.1) traced the leak, made the change and verified it red then green with
brew tests --no-parallel --only=bundle/tap,bundle/npm --seed=1andbrew lgtm --online. I reviewed the diff.Summary by CodeRabbit