test_script: Move Puppeteer downloads outside node_modules.

This way Puppeteer doesn’t have to re-download Chromium every time we
install new JavaScript dependencies.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-10-07 15:19:53 -07:00 committed by Tim Abbott
parent e0032223c8
commit 0027d7dea7
3 changed files with 11 additions and 1 deletions

View File

@ -78,3 +78,6 @@ natsort
# For spell check linter
codespell
# Finds appropriate directories for data, config, cache, etc.
platformdirs

View File

@ -1288,7 +1288,9 @@ pkgutil-resolve-name==1.3.10 \
platformdirs==2.5.2 \
--hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \
--hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19
# via black
# via
# -r requirements/dev.in
# black
polib==1.1.1 \
--hash=sha256:d3ee85e0c6788f789353416b1612c6c92d75fe6ccfac0029711974d6abd0f86d \
--hash=sha256:e02c355ae5e054912e3b0d16febc56510eff7e49d60bf22aecb463bd2f2a2dfa

View File

@ -5,6 +5,8 @@ import sys
from argparse import ArgumentParser
from typing import Iterable, List, Optional, Tuple
import platformdirs
from scripts.lib.zulip_tools import get_dev_uuid_var_path
from version import PROVISION_VERSION
@ -120,6 +122,9 @@ def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
def prepare_puppeteer_run(is_firefox: bool = False) -> None:
os.chdir(ZULIP_PATH)
download_path = platformdirs.user_cache_dir("zulip/puppeteer-download")
os.makedirs(download_path)
os.environ["PUPPETEER_DOWNLOAD_PATH"] = download_path
# This will determine if the browser will be firefox or chrome.
os.environ["PUPPETEER_PRODUCT"] = "firefox" if is_firefox else "chrome"
subprocess.check_call(["node", "node_modules/puppeteer/install.js"])