Skip to content

Latest commit

 

History

History
160 lines (104 loc) · 3.53 KB

File metadata and controls

160 lines (104 loc) · 3.53 KB

Testing And Quality Checks

This guide documents the validation steps that exist in the current Next.js-based website repo.

What Exists Today

The current project scripts are:

  • pnpm dev
  • pnpm build
  • pnpm start
  • pnpm test
  • pnpm coverage
  • pnpm update-snap
  • pnpm lint
  • pnpm format
  • pnpm format:check

Unit tests are colocated with the source they cover using __tests__ directories, following the same layout used in adoptium.net.

The first baseline suite currently covers src/lib/posts.ts from src/lib/tests/posts.test.ts.

Component tests live inside each component folder, for example src/components/Header/__tests__/Header.test.tsx. Snapshot files are added selectively under __snapshots__ when they provide stable, useful coverage. See 04-components.md for the full component layout convention.

App-level tests live under src/app/__tests__, for example src/app/__tests__/not-found.test.tsx and src/app/__tests__/sitemap.test.ts.

Although some testing dependencies are installed, the current CI workflows only enforce formatting, linting, and a production build.

Recommended Local Checks

Run these before opening a pull request:

pnpm format:check
pnpm lint
pnpm test
pnpm build

If you changed files under src/, it is often useful to run:

pnpm format

then re-run:

pnpm format:check

What Each Command Does

pnpm format

Runs Prettier on source files under src/**/*.{js,jsx,ts,tsx,json}.

Notes:

  • this does not automatically format Markdown docs
  • this does not rewrite files outside the configured src/ glob

pnpm format:check

Checks whether the files covered by the Prettier glob are already formatted.

Use this before committing source changes.

pnpm lint

Runs ESLint across the repo using the Next.js configuration in eslint.config.js.

This catches common TypeScript, React, and App Router issues.

pnpm test

Runs the Vitest suite once in jsdom.

Tests live beside the code they cover inside __tests__ directories, for example src/lib/__tests__/posts.test.ts.

pnpm coverage

Runs the same Vitest suite with V8 coverage enabled.

Use this when you want a local coverage report while expanding the baseline test surface.

pnpm update-snap

Runs the Vitest suite in snapshot update mode.

Use this after intentionally changing stable UI output that already has snapshot coverage.

pnpm build

Runs:

pnpm sync:repo-stats && next build

This is the closest thing to a production validation step and should pass before opening a PR.

pnpm dev

Runs:

pnpm sync:repo-stats && next dev

Use this while developing to preview page changes at http://localhost:3000.

CI Expectations

The current CI workflow runs:

  1. pnpm install --frozen-lockfile
  2. pnpm format:check
  3. pnpm lint
  4. pnpm test
  5. pnpm build

If one of these fails locally, it will likely fail in GitHub Actions too.

Content-Specific Validation Tips

Blog Posts

  • open /blog
  • open the individual post route
  • confirm the post is not accidentally left as draft
  • verify featured and inline image paths

Markdown-Backed Simple Pages

  • open the route locally
  • verify front matter values render correctly
  • confirm stripped shortcodes are not needed for the page

No Translation Test Matrix

There is no translation or locale test matrix because the site does not currently implement i18n.

Keep validation focused on the single English site.