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