Do not record recent files in test mode (#50)#139
Open
cansin wants to merge 3 commits into
Open
Conversation
Running the integration tests (and any USE run with -t) opened files via the shell, which pushed them onto the user's recent files list and pushed out the user's own entries. RecentItems.push now returns early when Options.testMode is set, so no recent items are recorded while USE runs in test mode. The recent files (stored in the user's preferences) are therefore left untouched by the test suite. The spec-file push in the launchers was already guarded this way; this covers the remaining path (the shell "open" command). Adds RecentItemsTest verifying push is ignored in test mode and still records otherwise. https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
Add @author Cansin Yildiz and @author Claude to the files added in this branch, and update the copyright year to 1999-2026. Co-authored-by: Claude <noreply@anthropic.com> https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
3ded03e to
d8264a7
Compare
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
Fixes #50.
Running USE in test mode (
-t) — e.g. theShellITintegration tests — openedfiles through the shell and recorded them in the user's recent files list,
pushing out the user's own entries.
Fix
RecentItems.push(...)now returns early whenOptions.testModeis set, sonothing is recorded while USE runs in test mode.
RecentItemsandOptionsarein the same package, and
recentSpecificationsis the onlyRecentItemsinstance, so this single guard covers every path that records recent files (the
shell
opencommand, and the spec-file push in the launchers — the latter wasalready guarded the same way).
The user's recent files (stored in Java Preferences) are therefore left untouched
by the test suite.
Testing
RecentItemsTest(use-core):pushis ignored in test mode and stillrecords normally otherwise.
use-coresuite and the 129ShellITintegration tests pass. Nointegration test depends on
reopen/ recent files.