This project has unit tests, accessibility tests, and linting checks.
Run the unit tests:
npm run test:unit
Run the accessibility test suite (builds first, then runs Jest):
npm run test:axe
Accessibility tests have a couple of known issues around colour contrast in headless browsers. See docs/accessibility-testing.md for details.
Run unit, aspComponent, and accessibility tests:
npm test
That is test:unit, test:component, then test:axe.
Run all linters:
npm run lint
That runs ESLint, Stylelint, and component YAML contract validation (validate:contracts).
Run individually:
npm run lint:js
npm run lint:css
npm run validate:contracts
GitHub Actions runs CSS lint, contract validation, and manifest checks. See docs/ci.md.
validate:contracts)scripts/validate-contracts.js checks that each component’s YAML examples match the JSON Schema declared in that component’s YAML.
src/njk/components/<id>/ when <id>.yaml includes schema.jsonSchema (path to the schema file, relative to the YAML file).examples[].options entry, the script validates the object with Ajv against the referenced *.schema.json.options (macro arguments) are wrapped as { type: "<componentId>", params: <options> } before validation — the same shape passed to aspComponent at render time.JSON Schema files live beside the YAML (for example src/njk/components/alert/alert.schema.json). Each schema’s root $id is a stable logical URN (urn:asp-frontend:component:<id>); it is not required to resolve over HTTP.
This checks examples vs schema, not Nunjucks template behaviour. After changing params, examples, or schemas, run npm run validate:contracts (or npm run lint) before pushing.
build:manifest / validate:manifest)scripts/build-component-manifest.js scans src/njk/components//macro.njk and src/twig/components//macro.twig, verifies macro names match, and writes:
src/component-manifest.json — registry used by aspComponent in Node and PHPsrc/twig/internal/asp-component-dispatch.twig — generated Twig dispatch (do not edit by hand)After adding or renaming a component macro, run npm run build:manifest. CI runs npm run validate:manifest (same script with --check) as part of npm run lint.
Nunjucks resolves macros at runtime via the manifest; Twig/PHP use the generated dispatch file.
validate:contracts also verifies every component with a JSON Schema has a matching manifest entry.
npm run test:component
See docs/asp-component.md for the Node module layout.
dotnet test src/dotnet/tests/AspFrontend.Tests/AspFrontend.Tests.csproj -c Release
Imported from docs/testing.md in asp-frontend.