@bandf/framework-testing
v1.8.1
Published
Test runners and suites for the bandf framework: unit, smoke, component, a11y, e2e, and api phases.
Readme
@bandf/framework-testing
@bandf/framework-testing supplies BandF's six test phases and the shared test API used by app specs. The framework command runs the phases in a fixed order and keeps going after a failed phase so one failure does not hide later results.
Contents
Run the suite
From a BandF workspace:
yarn test <app> <stage> <port>The app, stage, and port are resolved through the same CLI conventions as local development. Workspace scripts may expose individual phase commands for focused work.
Test phases
| Order | Phase | What it covers | | ----- | --------- | ---------------------------------------------------------------------- | | 1 | Unit | Framework and selected-app unit and integration specs; no live server. | | 2 | Smoke | Fast browser and route checks against a live app server. | | 3 | Component | React component mounts through Playwright Component Testing. | | 4 | A11y | Browser accessibility checks with Axe. | | 5 | E2E | Browser journeys against the live app. | | 6 | API | OpenAPI linting plus generated and common Newman collections. |
Each phase runs in its own subprocess. The combined runner records a failure and continues with the remaining phases. Coverage is produced by the workspace's c8 wrapper after the subprocesses exit. There is no separate visual-regression phase.
App-owned tests
App specs live below the selected app:
apps/<app>/tests/
├── unit/
├── integration/
├── smoke/
├── component/
├── a11y/
└── e2e/The Japa runners combine package-owned coverage with the selected app's matching directory. Component testing uses automatic discovery by default and can run manual specs from tests/component/ with the manual-mode flag.
The API phase does not require an app-owned API spec. It always exercises framework routes; when api/api.yml exists it also lints that document, generates requests for its operations, and verifies that the live endpoints remain below 500 for the baseline collection.
Live-server behavior
Smoke, accessibility, E2E, and API phases start the app through PM2 and Serverless Offline, then stop that process after the phase. These phases test the server artifact directly; they do not start Parcel or BrowserSync.
Readiness accepts any non-5xx response because authentication and route policy can legitimately return 4xx during boot probes. Persistent gateway-style 502, 503, and 504 responses are treated as a failed handler boot rather than a healthy listener.
Test API
App Japa specs import from the package root:
import { test } from "@bandf/framework-testing";The root entry re-exports the package's @japa/runner instance. Importing through this boundary ensures specs register with the same singleton that the BandF runner executes.
@bandf/framework-testing/runner is the combined command entry. Runner subpaths are framework orchestration internals rather than the normal app-spec API.
