Skip to content

The agent that grows with you

ci: run the WhatsApp bridge node tests in the JS & TS job

Tekniumdf128c13bb9d
diff --git a/.github/workflows/js-tests.yml b/.github/workflows/js-tests.yml
index 7efccf2c655..33b2569b0c6 100644
--- a/.github/workflows/js-tests.yml
+++ b/.github/workflows/js-tests.yml
@@ -78,6 +78,17 @@ jobs:
- name: Prepare locked Electron runtime before parallel checks
run: node scripts/build/electron-runtime.mjs --source .
+ # The WhatsApp bridge is a standalone npm package, outside the root
+ # workspaces, so run-workspace-checks never sees it. Two of its suites
+ # import @whiskeysockets/baileys, so install its own lockfile first;
+ # --ignore-scripts because the tests need no native build.
+ - name: Install WhatsApp bridge dependencies
+ uses: ./.github/actions/retry
+ with:
+ command: npm ci --ignore-scripts --no-audit --no-fund --prefix scripts/whatsapp-bridge
+ - name: Run WhatsApp bridge node tests
+ run: node --test scripts/whatsapp-bridge/*.test.mjs
+
# Every check runs at the same time. The step fails only after all of
# them finish. There are two reasons this is not ``npm run --ws check``.
#
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index 6481b7fd8a6..074bf55d889 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -21,7 +21,8 @@ Lanes:
touches (``_E2E_LANES``, the ``run-e2e`` label), but ci.yaml's ``detect``
gate forces these lanes off on pull requests and pushes to main: the E2E
suites run only on a release run or a manual dispatch.
-* ``frontend`` — TS typecheck matrix + desktop build.
+* ``frontend`` — TS typecheck matrix + desktop build, and the WhatsApp
+ bridge's ``node --test`` suites.
* ``site`` — Docusaurus + generated skill docs.
* ``scan`` — supply-chain scan (Python files, .pth, setup hooks).
* ``deps`` — pyproject.toml dependency bounds check.
@@ -94,6 +95,10 @@ import sys
_FRONTEND = ("ui-tui/", "web/", "apps/") # TS typecheck-matrix packages
# Shipped page outside those packages, exercised by the desktop Electron suite.
_FRONTEND_FILES = {"scripts/desktop-update/ui.html"}
+# The WhatsApp bridge's ``node --test`` suites run in the JS & TS job, so a
+# change to the bridge or to the Python adapter that speaks its protocol
+# selects ``frontend``.
+_WHATSAPP_BRIDGE = ("scripts/whatsapp-bridge/", "plugins/platforms/whatsapp/")
_ROOT_NPM = {"package.json", "package-lock.json"} # shifts every package's tree
_DOCKER_META = ("docker/", ".hadolint.yaml", "Dockerfile", ".dockerignore") # docker setup
_NIX_PATHS = ("nix/",) # nix files
@@ -628,7 +633,7 @@ def classify(files: list[str], run_e2e: bool = False) -> dict[str, bool]:
python_prod = any(not _py_irrelevant(f) and not _py_test_only(f) for f in code)
frontend = any(
f.startswith(_FRONTEND) or f in _ROOT_NPM or f in _FRONTEND_FILES
- or f.startswith("tests-js/")
+ or f.startswith(("tests-js/",) + _WHATSAPP_BRIDGE)
or (f.startswith("scripts/build/") and f.endswith((".mjs", ".js", ".ts")))
for f in files
)
diff --git a/tests/ci/test_classify_changes.py b/tests/ci/test_classify_changes.py
index 86bcca95139..dd73cfdaeb5 100644
--- a/tests/ci/test_classify_changes.py
+++ b/tests/ci/test_classify_changes.py
@@ -100,6 +100,13 @@ CASES = {
_lanes(frontend=True, e2e_upgrade=True, e2e_desktop_core=True, e2e_desktop_update=True, docker=True),
),
"root JS tests → frontend": (["tests-js/product-builders.test.mjs"], _lanes(python=True, frontend=True)),
+ # The bridge's node --test suites run in the JS & TS job (js-tests.yml).
+ "whatsapp bridge → frontend": (
+ ["scripts/whatsapp-bridge/bridge_helpers.js"], _lanes(python=True, frontend=True),
+ ),
+ "whatsapp adapter → frontend": (
+ ["plugins/platforms/whatsapp/adapter.py"], _lanes(python=True, frontend=True, scan=True),
+ ),
"docs-only → nothing heavy": (["README.md", "docs/guide.md"], _lanes()),
"python source → python": (["run_agent.py"], _lanes(python=True, scan=True)),
# pyproject.toml declares the pytest markers the OS lanes select on, so it