Skip to main content

Overview

Enforce the docs and type conventions Nova holds itself to — frontmatter, internal links, table formatting, glossary references, and type declarations — in your own project through importable Nova Vitest suites.

Install

If the package is not in your repo yet, go to Setup and Configure and choose Install into project.

warning

Nova must be installed in your project before importing the suites. This is because Node.js resolves imports from your project's node_modules folder.

info

Each suite imports describe and it from Vitest. Your project must already use Vitest as its test runner.

Purpose and Scope

Why Use This Kit?

  • Holds your project to the same standards Nova enforces on itself, so docs stay navigable and searchable and types stay safe to refactor.
  • Catches issues at test time — missing frontmatter, broken links, malformed tables, or type mirrors that have drifted from their source — before they reach a build or a reader.
  • Keeps every consumer in step: when Nova refines a convention, you adopt the improvement by bumping one dependency.
  • Ships its own types so config objects are checked by your editor as you write them.

Adoption

Each test file collapses to a short import-and-invoke. The suite logic lives in the package; your wrapper supplies the configuration.

src/tests/frontmatter.test.ts
ts
import { registerFrontmatterSuite } from '@cbnventures/nova/rules/vitest';
import * as vitest from 'vitest';

registerFrontmatterSuite({
  vitest,
  enable: 'all',
  requiredFields: ['id', 'title', 'description', 'keywords', 'tags'],
});

Every suite scans the current working directory by default, which is the project root when Vitest runs the normal vitest run. Override the root only when your layout differs.

Enable API

Every register function takes an enable field that selects which checks run. The field is required so a bare call is a compile error, never a silent no-op.

  • enable: 'all' runs every check the suite defines, including checks added in future versions.
  • enable: ['key-one', 'key-two'] runs exactly the listed checks and ignores the rest.

Checks are off by default and opt-in, so enabling a check on one project never forces it on another. A frozen list keeps a project's behavior stable even when Nova ships new checks.

src/tests/link.test.ts
ts
import { registerLinkSuite } from '@cbnventures/nova/rules/vitest';
import * as vitest from 'vitest';

// Run a frozen subset instead of every check.
registerLinkSuite({
  vitest,
  enable: [
    'link-internal-doc-target-exists',
    'link-self-anchor-exists',
  ],
});

Suites

Each suite ships a register*Suite(config) function with its own config shape and toggle keys.

SuiteSynopsis
DotenvEnforce double-quoted values in .env and .env.sample files.
FrontmatterRequire valid frontmatter fields on every Markdown and MDX content file.
LinkVerify internal documentation links and anchors resolve to real targets.
Markdown TableRequire tables to match canonical MarkdownTable output.
TerminologyValidate <Terminology> components against a glossary page.
Type DeclarationsAudit .d.ts mirror files against their sources for structure, order, and naming.

Using Nova's custom ESLint rules too? See Rules for the lint-time delivery of Nova's conventions.