Skip to content

Commit 533b582

Browse files
authored
Remove the saved Sublime Text session before each Docker run (#309)
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.
1 parent 24e807c commit 533b582

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎docker/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ ut-run-tests . --file Example.sublime-syntax
5858

5959
The container entrypoint writes a marker in `/root/.cache/unittesting`.
6060
With `-v unittesting-home:/root`, bootstrap/install runs once and later runs
61-
only refresh your package files and execute tests.
61+
only refresh your package files and execute tests. Each run removes the
62+
session that Sublime Text saved in the previous run, so that no views from
63+
earlier runs are open when the tests start.
6264

6365
## Concurrent runs and races
6466

‎docker/entrypoint.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ ensure_sublime_text_arch_matches() {
115115
fi
116116
}
117117

118+
clear_saved_session() {
119+
# Sublime Text is killed after the tests, so the cache volume keeps the
120+
# session that it last saved, with the views that tests had open then.
121+
# Start without it, like a CI runner does, so that Sublime Text doesn't
122+
# restore those views.
123+
rm -f "${ST_PACKAGES_DIR%/*}/Local/"*.sublime_session
124+
}
125+
118126
ensure_sublime_text_arch_matches
119127
sudo sh -e /etc/init.d/xvfb start
120128
ensure_git_identity
@@ -127,6 +135,7 @@ if [ "$SUBLIME_TEXT_VERSION" -ge 4 ]; then
127135
else
128136
ST_PACKAGES_DIR="$HOME/.config/sublime-text-$SUBLIME_TEXT_VERSION/Packages"
129137
fi
138+
clear_saved_session
130139

131140
if [ -d "$UNITTESTING_SOURCE/sbin" ]; then
132141
# Ensure UnitTesting comes from the local checkout running this script,

0 commit comments

Comments
 (0)