test: skip generated extension bundle checks when missing
Testing / remote-protocol-compat (0.9.3) (push) Successful in 45s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 47s
Testing / test (push) Successful in 57s

- Add a shared helper for reading the built extension background bundle.
- Skip the Firefox/WebExtension linter assertions when the generated bundle is absent.
- Keep fresh checkouts able to run pytest without building gitignored artifacts first.
This commit is contained in:
2026-06-14 17:26:20 +02:00
parent 9b8cefcd72
commit 523108e442
+10 -2
View File
@@ -1,7 +1,15 @@
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
def read_built_background() -> str:
background_path = ROOT / "extension" / "background.js"
if not background_path.exists():
pytest.skip("extension/background.js is a generated build artifact; run npm run build:extension")
return background_path.read_text()
def test_extension_retries_error_page_script_injection_before_failing():
# core.ts was split into a core/ subfolder during the structure refactor:
# the URL/error classifiers live in core/errors.ts and the executeScript
@@ -123,7 +131,7 @@ def test_tab_activation_open_and_merge_do_not_steal_audible_video_window():
assert "const target = movableWindows.find(w => w.focused) || movableWindows[0];" in tabs
def test_built_extension_avoids_static_firefox_unsupported_tab_group_api_refs():
background = (ROOT / "extension" / "background.js").read_text()
background = read_built_background()
assert "chrome.tabGroups" not in background
assert "chrome.tabs.group" not in background
@@ -132,7 +140,7 @@ def test_built_extension_avoids_static_firefox_unsupported_tab_group_api_refs():
assert 'chrome.tabs["group"' in background
def test_built_extension_avoids_direct_eval_token_for_firefox_linter():
background = (ROOT / "extension" / "background.js").read_text()
background = read_built_background()
assert "(0, eval)(" not in background
assert "eval(" not in background