Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 3.32 KB

testing.md

File metadata and controls

51 lines (43 loc) · 3.32 KB

Automated verification

Use the Node 24 LTS selected by .node-version for development and CI (minimum compatible version: 22.18), then npm ci, npm run test:prepare, and npm run verify. Preparation uses the installed Playwright CLI (exact pin in package.json), including its matching Chromium and OS libraries; Linux may require sudo for OS dependencies. No npx package download or user-cache search participates in browser tests. Playwright's standard PLAYWRIGHT_BROWSERS_PATH can select an isolated cache; it must contain this package's matching browser revision.

Verify builds once, checks committed dist/bridge freshness, metadata, the strict tsc type check (tsconfig.json, no emit), ESLint (eslint.config.js, zero errors) and formatting (scripts/format.sh --check), then runs the complete node:test suite. Independent lint/test commands build first. The complete entries accept no filters. For focused debugging use node --import ./scripts/jsx-loader.mjs --test test/<name>.test.mjs after building (the loader lets tests import .ts/.tsx sources through the same esbuild transform options as the bundle; npm test sets it for every file).

The five required browser tests retain their existing exact name plus owning file as the identifier (listed in scripts/run-tests.mjs). Quota disposal and sync drafts, Assistant lifecycle, JavDB compatibility, QR state capture and Feishu page.evaluate equivalence must each emit exactly one passing result. Missing, duplicate, skipped, todo or failed results fail verification; any other suite failure, skip or todo also prevents a green complete report. This uses Node's native TestsStream pass/fail events, including skip/todo metadata, and never parses console TAP.

Reports live under .scratch/test-report/:

  • preparation.json: commit, preparation scope, Node/Playwright versions, browser/OS setup duration, exit and environment-ready/environment-unavailable.
  • results.json: tested HEAD and dirty flag, Node/Playwright/launched browser versions, scope, environment preflight/build/test timings, per-test results and failure/skip reasons, and each mandatory acceptance result.

Reports explicitly mark preparation, preflight, build/checks and tests as passed, failed or not-run as applicable. Counts are null when tests did not execute, so an unavailable environment cannot look like a zero-test success. The independent test runner marks build as not-in-this-entry: npm test owns its separate pretest build, while verify records its own build stage.

CI uploads this directory through GitHub Actions artifacts even on failure. No full environment, credentials, browser state or real account data is added to reports. Browser fixtures use synthetic content. Browser version comes from a launched browser; the report's commit identifies HEAD and the dirty flag explicitly marks a run over uncommitted edits.

These tests do not establish userscript-manager installation, human interaction or live-site compatibility. Real ChatGPT/JavDB/Feishu pages, actual QR login, third-party userscripts and manual browser acceptance remain separate pending checks. Daily browser-tools keep their compatibility loader; its fallback test copies the real module outside the checkout so the pinned project dependency cannot hide fallback behavior.