From 523108e442a90b5108155d2f60771c5ee61637ce Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 14 Jun 2026 17:26:20 +0200 Subject: [PATCH] test: skip generated extension bundle checks when missing - 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. --- tests/test_extension_error_page_handling.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_extension_error_page_handling.py b/tests/test_extension_error_page_handling.py index 623625e..3012029 100644 --- a/tests/test_extension_error_page_handling.py +++ b/tests/test_extension_error_page_handling.py @@ -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