From c7e05c68623b22615b9b6520cb2ee2920f1d4a4c Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Thu, 29 Oct 2026 09:57:23 +0100 Subject: [PATCH] Remove the saved Sublime Text session before each Docker run Sublime Text is killed after the tests, so the cache volume keeps the session that it last saved, with the views that tests had open at that time. The next run restored those views before the tests started, which made tests that expect no open views fail locally, while they passed on CI, where every run starts without a session. --- docker/README.md | 4 +++- docker/entrypoint.sh | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 733d930b..541b7612 100644 --- a/docker/README.md +++ b/docker/README.md @@ -58,7 +58,9 @@ ut-run-tests . --file Example.sublime-syntax The container entrypoint writes a marker in `/root/.cache/unittesting`. With `-v unittesting-home:/root`, bootstrap/install runs once and later runs -only refresh your package files and execute tests. +only refresh your package files and execute tests. Each run removes the +session that Sublime Text saved in the previous run, so that no views from +earlier runs are open when the tests start. ## Concurrent runs and races diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 07f8f11e..e58ba16e 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -115,6 +115,14 @@ ensure_sublime_text_arch_matches() { fi } +clear_saved_session() { + # Sublime Text is killed after the tests, so the cache volume keeps the + # session that it last saved, with the views that tests had open then. + # Start without it, like a CI runner does, so that Sublime Text doesn't + # restore those views. + rm -f "${ST_PACKAGES_DIR%/*}/Local/"*.sublime_session +} + ensure_sublime_text_arch_matches sudo sh -e /etc/init.d/xvfb start ensure_git_identity @@ -127,6 +135,7 @@ if [ "$SUBLIME_TEXT_VERSION" -ge 4 ]; then else ST_PACKAGES_DIR="$HOME/.config/sublime-text-$SUBLIME_TEXT_VERSION/Packages" fi +clear_saved_session if [ -d "$UNITTESTING_SOURCE/sbin" ]; then # Ensure UnitTesting comes from the local checkout running this script,