Skip to content

Development and Testing

Daniel J. Saldaña edited this page Oct 29, 2026 · 2 revisions

Development and Testing

🇪🇸 Español

Conventions

  • JavaScript/JSX only. Shared contracts are documented with JSDoc in types.js files.
  • One component per folder (index.jsx). Hooks own state, cancellation and reload; api/ services perform requests; src/core/ has no React and no HTTP.
  • UI uses shadcn/ui (New York, Radix UI) under src/components/ui/primitives/, Tailwind CSS 4 and Recharts 3 through ChartContainer. Add controls with npx shadcn@latest add <component> and adapt them to the folder layout and i18n.
  • Every user-facing text has English and Spanish entries. Azure identifiers and values are kept verbatim.
  • npm run lint enforces hook rules and layer boundaries, and rejects let, nested ternaries and promise chains.

Tests

npm test                 # unit tests
npm run test:functions   # collector tests
npm run lint && npm run format:check && npm run build

PostgreSQL integration tests

RUN_DB_TESTS=1 npm test

They need a temporary database whose name ends in _test. They cover repeatable migrations, publication of the 73 views, repeatable seed, rollback and deduplication.

Browser tests

npx playwright install chromium
npm run test:e2e

They build and start the production server on port 4100 with their own demo session, a random schema and fake data. They cover navigation, language switch, filters, charts, the refresh lock with two users, FinOps, Administration and the architecture view, on desktop and mobile.

Product website tests

npm run test:site

Builds the static site and runs its browser tests. See Product Website.

Tests mock the cloud SDKs and never perform a real Entra ID sign-in.

Continuous integration

dashboard-check.yml runs on pull requests and pushes to main, selecting suites from the complete diff. Documentation-only changes check formatting without PostgreSQL, browser tests or CodeQL. Code changes validate the affected dashboard, collector, site and infrastructure. Shared inputs also validate their consumers.

The required CI check always reports a result and blocks merging when an applicable job fails or is cancelled. External workflow runs require maintainer approval; pull requests receive no deployment credentials and never deploy. CodeQL also runs weekly. Dependabot proposes updates without automatically merging them.

To run all suites manually, select Actions → Goliat - CI → Run workflow → main. See CONTRIBUTING.md and the workflow guide.

Regenerating assets

Command Output
npm run docs:diagram docs/architecture.html and docs/azure-deployment.html
npm run assets:brand Logo, favicon, Apple icon and social cover
npm run docs:azure-example Empty example of the inventory document
npm run inventory:sync Synchronises the inventory contract with the collector

Contributing

  1. Fork the repository and create a branch.
  2. Keep changes focused and add tests for new behaviour.
  3. Run lint, format check and the relevant test suites.
  4. Open a pull request describing the change.

Report security issues privately, as described in Security.

Clone this wiki locally