Scope legacy launcher checks to Tauri and protect Electron backend reuse
This commit is contained in:
@@ -30,7 +30,7 @@ _APPIMAGE_PROCESSES = os.path.join(_ROOT, "scripts", "desktop_prod_processes.py"
|
||||
|
||||
# Scripts whose NAME promises a re-launch of an existing build rather than a
|
||||
# fresh-install emulation. Add new aliases here when they appear.
|
||||
_RELAUNCH_SCRIPTS = ("desktop-prod:run", "desktop-prod:run:pill")
|
||||
_RELAUNCH_SCRIPTS = ("tauri:desktop-prod:run", "tauri:desktop-prod:run:pill")
|
||||
|
||||
|
||||
def _supported_bash() -> str | None:
|
||||
@@ -87,12 +87,12 @@ def test_fresh_install_emulation_still_wipes():
|
||||
"""The other side of the branch: the default must stay a real fresh run,
|
||||
otherwise this test would 'pass' by making every script harmless."""
|
||||
scripts = _scripts()
|
||||
assert "--keep-data" not in scripts["desktop-prod"], (
|
||||
assert "--keep-data" not in scripts["tauri:desktop-prod"], (
|
||||
"desktop-prod is the fresh-install emulation — it must still wipe"
|
||||
)
|
||||
# `desktop-fresh:run` is deliberately NOT in _RELAUNCH_SCRIPTS: that script
|
||||
# is a stricter new-user emulation, so wiping is the point of its name.
|
||||
assert "--keep-data" not in scripts["desktop-fresh:run"]
|
||||
assert "--keep-data" not in scripts["tauri:desktop-fresh:run"]
|
||||
|
||||
|
||||
def test_skip_build_does_not_imply_keep_data_in_the_script():
|
||||
|
||||
@@ -63,14 +63,14 @@ def test_ready_linux_host_has_no_problem() -> None:
|
||||
assert _probe("linux", "ID=fedora", xdo=True, audio_sink=True)["problem"] is None
|
||||
|
||||
|
||||
def test_every_source_launcher_runs_the_preflight() -> None:
|
||||
def test_legacy_tauri_launchers_run_the_webkit_preflight() -> None:
|
||||
for relative_path in ("scripts/desktop-dev.mjs", "scripts/desktop-prod.mjs"):
|
||||
launcher = (_ROOT / relative_path).read_text()
|
||||
assert 'from "./desktop-runtime-preflight.mjs"' in launcher
|
||||
assert "if (!desktopRuntimeReady()) process.exit(1);" in launcher
|
||||
|
||||
package = json.loads((_ROOT / "package.json").read_text())
|
||||
predesktop = package["scripts"]["predesktop"]
|
||||
predesktop = package["scripts"]["pretauri"]
|
||||
assert "desktop-runtime-preflight.mjs" in predesktop
|
||||
assert predesktop.index("desktop-runtime-preflight.mjs") < predesktop.index("clear-dev-ports.mjs")
|
||||
|
||||
|
||||
@@ -110,9 +110,9 @@ def test_compatibility_identifiers_stay_stable() -> None:
|
||||
).read_text()
|
||||
|
||||
|
||||
def test_source_launch_cleans_idle_ports_quietly() -> None:
|
||||
def test_legacy_source_launch_cleans_idle_ports_quietly() -> None:
|
||||
scripts = json.loads((ROOT / "package.json").read_text())["scripts"]
|
||||
for name in ("predev", "predesktop"):
|
||||
for name in ("predev:web", "pretauri"):
|
||||
command = scripts[name]
|
||||
assert "bun scripts/clear-dev-ports.mjs 3900 3901" in command
|
||||
assert "|| true" not in command
|
||||
@@ -124,3 +124,13 @@ def test_icon_rail_has_no_static_section_captions_and_keeps_air_between_items()
|
||||
assert stale_caption not in rail
|
||||
assert "pt-[18px]" in rail
|
||||
assert "gap-[9px]" in rail
|
||||
|
||||
|
||||
def test_electron_launch_preserves_an_existing_backend():
|
||||
scripts = json.loads((ROOT / "package.json").read_text())["scripts"]
|
||||
for name in ("predev", "predesktop"):
|
||||
assert "clear-dev-ports" not in scripts[name]
|
||||
assert "desktop-runtime-preflight" not in scripts[name]
|
||||
assert scripts["dev"] == "bun run --cwd electron dev"
|
||||
assert scripts["desktop-prod:run"] == "bun run start"
|
||||
assert scripts["start"] == "bun run --cwd electron start"
|
||||
|
||||
Reference in New Issue
Block a user