Testing & QA
Relevant source files
The following files were used as context for generating this wiki page:
Testing and Quality Assurance (QA) in the nuxt-i18n-micro project ensures framework stability, performance efficiency, and documentation accuracy. The testing architecture spans unit tests for individual packages, end-to-end (E2E) integration tests for Nuxt applications, production smoke tests, and automated performance benchmarking.
The project prioritizes low runtime costs and fast build times, which are verified through a dedicated performance suite and automated audits of the API surface. Integration tests spawn their own Nuxt servers in-process to validate behavior in environments mimicking real-world usage.
Sources: AGENTS.md:16-20, AGENTS.md:92-105
Test Categories and Execution
The project categorizes tests based on scope and execution speed. Developers run these via pnpm scripts located in the root directory.
| Test Level | Command | Scope |
|---|---|---|
| Unit | pnpm run test:unit | Fast tests including tsc and vue-tsc validation for test/**. |
| E2E / Integration | pnpm run test:e2e | Browser-based tests using Playwright and in-process Nuxt servers. |
| Package Project | pnpm run test:packages | Tests specific to framework bindings (React, Solid, Astro, etc.). |
| Performance | pnpm test:performance | Benchmarking build times, memory usage, and RPS against baseline fixtures. |
| Type Checking | pnpm run typecheck | Global TypeScript validation and module augmentation checks. |
Sources: AGENTS.md:96-103, packages/test-utils/package.json:61-66
Smoke Verification
The smoke-verify command asserts that a running deployment (local, Cloudflare, or Vercel) functions correctly. It performs sequential HTTP requests to avoid overloading the target server and verifies critical localized behaviors.
Smoke Test Workflow
The diagram shows the sequential verification process used to validate a deployment.
Key verification points include:
- SSR Content: Confirms that default and localized routes (e.g.,
/de,/fr) render correct translated strings. - SEO Meta: Validates
hreflangalternates,x-default,canonicallinks, andog:localetags. - Payload Accuracy: Ensures
/_locales/.../data.jsonendpoints return valid JSON and correct cache-control headers. - Raw Key Detection: Scans HTML for unparsed translation keys (e.g.,
nav.home) which indicate a broken payload.
Sources: scripts/src/commands/smoke-verify.ts:42-146
Performance Benchmarking
Performance tests compare i18n-micro against Nuxt baseline and @nuxtjs/i18n (v10). The suite measures three primary dimensions: Build Performance, Bundle Impact, and Load Metrics.
Performance Measurement Flow
The sequence diagram illustrates how build metrics and load data are collected to generate the performance report.
The PerfReporter captures the following metrics:
- Build Metrics: Build time (seconds), Peak RSS (MB), and CPU percentage.
- Bundle Analysis: Size of code vs. size of translations (assets) in the
.outputdirectory. - Load Metrics: Average response time, P95 latency, and Requests Per Second (RPS) using Artillery.
Sources: scripts/src/perf/report.ts:74-126, scripts/src/perf/report.ts:241-260
Documentation Auditing
The docs-audit command prevents "documentation drift" by ensuring the written guides stay in sync with the codebase. This tool detects four specific types of drift that standard build steps overlook.
Audit Findings
| Finding Code | Level | Description |
|---|---|---|
undocumented-option | Error/Warning | A ModuleOption exists in code but is not mentioned in Markdown. |
handwritten-option | Error | An option is described manually instead of using a generated facts region. |
dead-nav-link | Error | A link in the VitePress config points to a non-existent file. |
unlinked-page | Warning | A Markdown file exists but is not reachable from the sidebar or nav. |
Sources: scripts/src/commands/docs-audit.ts:16-25, scripts/src/commands/docs-audit.ts:133-210
Integration Testing (Playwright & Vitest)
Integration tests verify the runtime behavior of the Nuxt module, including SEO, hydration, and component reactivity.
- SEO Integration: Validates that
@nuxtjs/seoworks without dependency errors, checkingrobots.txt,sitemap_index.xml, and JSON-LD Schema.org data. - Production Build Checks: Tests specifically for SSG (Static Generation) and SSR (Server Side Rendering) modes to ensure async components and translations hydrate without mismatches.
- Locale Switching: Asserts that client-side navigation via
i18n-linkor$switchLocaleRouteupdates URLs and page content correctly without flickering back to raw translation keys.
Sources: test/nuxt-seo.spec.ts:5-80, test/async-components-production.test.ts:88-125, test/basic.spec.ts:405-430
Testing and QA in nuxt-i18n-micro utilize a multi-faceted approach to maintain a performance-focused i18n solution. By combining strict type checking, automated performance benchmarks, and deployment-agnostic smoke tests, the project ensures that code changes do not regress runtime speed or user-facing functionality.