Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: centralize add-on cleanup in test helper #3273

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

alexcrocha
Copy link
Contributor

Motivation

Following up on #3271 (comment). The test helper should be handling all add-on cleanup.

Implementation

Moved lingering add-on cleanup logic from individual tests into the with_server method's ensure block, to centralize cleanup responsibility and reduce duplication across the test suite.

Move lingering addon cleanup logic from individual tests into the
`with_server` method's ensure block, to centralize cleanup
responsibility, and reduce duplication across the test suite.
@alexcrocha alexcrocha added the chore Chore task label Mar 5, 2025
@alexcrocha alexcrocha requested review from andyw8 and vinistock March 5, 2025 18:43
@alexcrocha alexcrocha requested a review from a team as a code owner March 5, 2025 18:43
Copy link

graphite-app bot commented Mar 5, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup

@alexcrocha alexcrocha merged commit 884bcc3 into main Mar 5, 2025
43 checks passed
@alexcrocha alexcrocha deleted the ar/clear-addon-classes branch March 5, 2025 19:14
@@ -43,6 +43,7 @@ def with_server(source = nil, uri = Kernel.URI("file:///fake.rb"), stub_no_typec
ensure
if load_addons
RubyLsp::Addon.addons.each(&:deactivate)
RubyLsp::Addon.addon_classes.clear
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can substitute all of these by RubyLsp::Addon.unload_addons, which has the full logic to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants