CodeVetter · Repo Unpack · Testing signals
Chalarangelo/30-seconds-of-code
Tests are Vitest specs under spec/, mirroring src/ structure: core, models, presenters, and lib/contentUtils. Coverage is real but selective — model logic, presenters, ranker, tocReader, stringUtils, search utils, metaParser, and an integration-style prepareContent test against fixture content. Factories (base + named traits) are the fixture mechanism, built through Loader.buildFactories. CI runs 'npm ci && npm test' on Node 22.14 for pushes and PRs to master. Notable gaps: no specs for serializers, page adapters, documentIndex/documentSearch/porterStemmer, assetHandler, extractor end-to-end, or any Astro/client code.
- 'npm test' runs bare 'vitest' (no config file found at repo root); CI invokes the same command on Node 22.14.0 for push/PR to master.
- Spec layout mirrors src/: spec/core (model, serializer), spec/models (collection, contentModel, snippet), spec/presenters (breadcrumb, cover, recommendation, sublink), spec/lib (contentUtils, ranker, tocReader, stringUtils, search/utils, metaParser).
- The fixture mechanism is factory objects: spec/factories export {model, base, traits} and Loader.buildFactories() composes base + named traits + inline overrides, then news up the registered model class.
- spec/lib/contentUtils/contentUtils.test.js is an integration test: it vi.mocks the config module to point at spec/fixtures/content and FileHandler.write to capture output, then runs the real ContentUtils.prepareContent and asserts output keys and language objects.
- spec/fixtures/content is a miniature of the real content tree — snippets (js/css/articles), collections (js/css/webdev), languages (js/css/html), grammars.yaml, hub.yaml, rankingEngine.yaml — letting the pipeline run end-to-end without touching real content.
- snippet.test.js demonstrates the shared-global-state pattern: Loader.loadModules() and Factory.create() calls run at describe scope, registering instances into the process-global Model.instances registry — meaning tests are implicitly order/isolation sensitive. (inferred)
- Coverage gaps: no spec exists for serializers/*, adapters/*, lib/search/documentIndex.js, documentSearch.js, porterStemmer.js, extractor.js, assetHandler.js, astroContent.js, or any src/astro code — the .content/pages JSON contract and the browser search index have no automated tests.
- Linting is eslint 9 flat config (js.configs.recommended + eslint-config-prettier) with a custom globals.js file; style rules enforce single quotes, semicolons, multiline comma-dangle, as-needed arrow-parens; prettier + prettier-plugin-astro via .prettierrc. No lint or format check runs in CI.
- Other workflows are maintenance automation only: stale.yml marks inactive issues/PRs via actions/stale@v5 and label.yml applies path-based PR labels via actions/labeler@v4 — neither runs tests or builds.
- There is no coverage tooling, no e2e/browser test, and no build-verification step in CI — the 'test' job is the only quality gate and it never runs 'astro build' or 'bin/prepare full'.