Releases: stevez/nextcov
v1.0.0
[1.0.0] - 2024-12-27
🎉 Stable Release
nextcov has reached 1.0! This release marks API stability and production readiness.
What nextcov provides:
- V8 code coverage for Next.js and Vite applications with Playwright E2E tests
- Merge Playwright E2E coverage with Vitest unit test coverage
- Support for React Server Components testing through E2E
- Auto-detection of dev mode vs production mode
- Client-only mode for Vite, static sites, and SPAs
Key features:
nextcov init- Interactive project setupnextcov merge- Merge multiple coverage reportsnextcov check- Detect V8 coverage blind spots and configuration issues
Quality metrics:
- 777 tests passing
- 74% code coverage
- Zero technical debt (no TODO/FIXME markers)
- Strict TypeScript with full type safety
- Professional error handling throughout
Since 0.1.0:
- 12 minor releases with continuous improvements
- Comprehensive documentation with two example projects
- Battle-tested in production applications
v0.12.2
[0.12.2] - 2024-12-27
Added
-
Project Configuration Checks in
checkcommand - Now scans project configuration in addition to code patterns- Separate output sections for "Project Configuration" and "Code Pattern Issues"
- Severity levels: error (✗), warning (⚠), info (ℹ)
Configuration checks:
Check Severity Description Outdated browserslist error Browser targets don't support ?.and??(min: chrome 111, edge 111, firefox 111, safari 16.4)Babel detected error Babel config found (may transpile modern syntax, breaking V8 coverage) Playwright not found error @playwright/test not in devDependencies (required for nextcov) Missing browserslist warning No browserslist config - ?.and??may be transpiled, causing phantom branchesJest detected warning Jest config found (consider using Vitest for V8 coverage) Source maps not enabled warning productionBrowserSourceMaps: truenot found in next.configVitest not found info Vitest not in devDependencies (recommended for V8 coverage) -
New files:
src/linter/detectors/project-config.ts- Project configuration detectorsrc/linter/config-scanner.ts- Configuration scanner wrappersrc/linter/detectors/__tests__/project-config.test.ts- Detector tests (20 tests)src/linter/__tests__/config-scanner.test.ts- Scanner tests (7 tests)
-
New
--skip-configflag forcheckcommand - Skip project configuration checksnpx nextcov check # config only (no paths) npx nextcov check src/ # config + source code npx nextcov check src/ --skip-config # source code only
Changed
-
checkcommand behavior - Config is checked by default, source only scanned if paths providednpx nextcov check→ config onlynpx nextcov check src/→ config + sourcenpx nextcov check src/ --skip-config→ source only
-
checkcommand output - Now shows two sections:Project Configuration: ───────────────────────────────────────────────────────── ✗ Browserslist targets outdated browsers ⚠ Jest detected - consider using Vitest for V8 coverage V8 Coverage Readiness Check ═══════════════════════════════════════════════════════════ ...code pattern issues... -
Exit code behavior - Returns 1 if config errors OR code issues found (unless
--ignore-patterns)
Tests
- Total tests: 777 passing (up from 742)
- New tests for config detection, scanning, and
--skip-configflag
v0.12.1
[0.12.1] - 2024-12-27
Added
-
Dependencies - Added for enhanced check command output
chalk@^4.1.2- Terminal color output for ESLint-style formatting
-
Documentation - Enhanced README with comprehensive CLI command reference
- Added "CLI Commands" section documenting all three commands (
init,merge,check) - Added "Detecting V8 Coverage Blind Spots" section with problem description, solutions, and real-world impact
- Included before/after code examples showing how to fix blind spots
- Added CI integration examples for GitHub Actions
- Documented real-world metrics: refactoring JSX patterns increased trackable branches from 433 to 445 (+12 paths)
- Added "CLI Commands" section documenting all three commands (
Changed
- Console Reporter - Enhanced with colored output using chalk
- ESLint-style colored output for better readability
- Bold code snippets in verbose mode
- Color-coded file paths, warnings, and messages
v0.12.0
[0.12.0] - 2024-12-26
Added
-
New
checkCLI command - Scan codebase for V8 coverage blind spots in JSX code- Detects JSX ternary operators:
{cond ? <A /> : <B />}that V8 cannot track for branch coverage - Detects JSX logical AND operators:
{cond && <Component />}that V8 cannot track for branch coverage - Only flags patterns inside JSX expression containers (
{...}), not variable assignments - Usage:
npx nextcov check [paths...] [options] - Options:
--verbose- Show code snippets in console output--json- Output results as JSON--ignore-patterns- Exit with 0 even if issues found (for CI warnings)
- Returns exit code 0 (clean), 1 (issues found), or 2 (error)
- Scans
.js,.jsx,.ts,.tsxfiles - Automatically ignores
node_modules/,.next/,dist/,build/,.git/,coverage/ - Example:
npx nextcov check src/ --verbose
- Detects JSX ternary operators:
-
JSX Pattern Detector - AST-based detection using Babel parser
- Uses
@babel/parserto parse JSX/TypeScript code into AST - Uses
@babel/traverseto walk AST and find problematic patterns - Gracefully handles syntax errors and non-JSX files
- Tracks parent nodes to distinguish JSX expression containers from variable assignments
- Extracts code snippets for verbose output
- Comprehensive test suite with 18 tests (92.68% statement coverage)
- Uses
-
File Scanner - Glob-based directory scanning
- Scans directories recursively for JS/TS files
- Supports specific file paths or directory patterns
- Custom ignore patterns support
- Relative file path output
- Comprehensive test suite with 13 tests (95% statement coverage)
-
Console Reporter - Formatted output for scan results
- Human-readable console output with file:line:column locations
- JSON output mode for programmatic consumption
- Verbose mode with code snippets
- Issue grouping by file
- Help text with remediation guidance
- Comprehensive test suite with 13 tests (100% coverage)
-
Dependencies - Added for JSX pattern detection
@babel/traverse@^7.28.5- AST traversal with visitor pattern@types/babel__traverse@^7.28.0- TypeScript type definitions
Changed
- CLI bundle size increased - From 74 KB to 80.13 KB (~8% increase)
- Babel dependencies added for JSX pattern detection (~6 KB impact)
- Acceptable trade-off for check command functionality
Tests
- Improved test coverage - Added 56 new tests across 4 test files
- Total tests: 742 passing (up from 686)
- New test files:
src/linter/detectors/__tests__/jsx-patterns.test.ts(18 tests)src/linter/__tests__/scanner.test.ts(13 tests)src/linter/__tests__/reporter.test.ts(13 tests)src/cli/commands/__tests__/check.test.ts(12 tests)
- Linter module coverage: 98.46% statement, 100% branch, 100% function
v0.11.2
[0.11.2] - 2024-12-26
Changed
- Reduced public API surface for smaller bundle size - Minimized main entry point exports
- Removed 60+ internal exports from
src/index.tsthat users should never import directly - Removed default value exports (
DEFAULT_NEXTCOV_CONFIG,DEFAULT_INCLUDE_PATTERNS, etc.) - only needed internally - Removed utility function exports (
normalizePath) - only needed internally - Kept only 5 essential runtime exports:
loadNextcovConfig,resolveNextcovConfig,mergeCoverage,printCoverageSummary,printCoverageComparison - Type definitions (
NextcovConfig, etc.) remain available for TypeScript users - Most users import from
nextcov/playwrightinstead of main entry point - Bundle size reduced from 143 KB to 27.28 KB (~81% reduction)
- Updated README.md API documentation to reflect minimal public API
- Removed 60+ internal exports from
v0.11.1
[0.11.1] - 2024-12-26
Changed
-
Comprehensive codebase reorganization - Restructured entire codebase into focused domain folders for better maintainability and scalability
- Phase 1 (v0.11.0): Split
converter.tsandconstants.tsinto modularconverter/andparsers/folders - Phase 2: Organized utilities into
utils/folder- Moved
config.ts,logger.ts,constants.ts,dev-mode-extractor.tstosrc/utils/ - Created
utils/index.tsfor centralized exports
- Moved
- Phase 3: Organized CLI into
cli/folder structure- Split
cli.tsintocli/commands/merge.tsandcli/index.ts - Moved
init.tstocli/commands/init.ts - Created
cli/index.tsas main CLI entry point
- Split
- Phase 4: Organized core processing modules into
core/folder- Moved
processor.ts,v8-reader.ts,reporter.ts,sourcemap-loader.tstosrc/core/ - Created
core/index.tsfor centralized exports - Removed unnecessary
converter.tsre-export layer
- Moved
- Phase 5: Organized worker modules into
worker/folder- Moved
ast-worker.tsandworker-pool.tstosrc/worker/ - Created
worker/index.tsfor centralized exports - Updated worker path resolution for new
dist/worker/build location - Updated tsup config to output workers to
dist/worker/
- Moved
- Phase 6: Organized merger module into
merger/folder- Split
merger.ts(968 lines) into 3 focused files:merger/core.ts(842 lines) - CoverageMerger class and merging logicmerger/printer.ts(65 lines) - Console output formattingmerger/utils.ts(86 lines) - Helper functions and lookups
- Created
merger/index.tsfor centralized exports
- Split
- Phase 1 (v0.11.0): Split
-
Refactored imports to use TypeScript path aliases - Replaced relative imports (
../../) with clean@/prefix- Configured TypeScript path aliases in tsconfig.json with
@/*mappings - Added tsc-alias to build script for path resolution in compiled JavaScript
- Updated vitest.config.ts with resolve.alias configuration
- Migrated 35+ files across all modules (cli, core, converter, merger, utils, worker, collector, parsers)
- Updated dynamic imports and vi.mock paths in CLI commands and tests
- Configured TypeScript path aliases in tsconfig.json with
Internal
- Build system enhancement - Added tsc-alias step after tsup compilation
- Build script now:
tsup && tsc-aliasto resolve path aliases in output
- Build script now:
- TypeScript error fixes - Fixed type inference issues in test files
- Added
FileCoverageDatatype casts to.toJSON()calls in coverage tests - Fixed incorrect test assertions with extra parameters
- Removed non-existent exports (
setVerbose,WorkerResult)
- Added
- New folder structure - Codebase now organized into 9 domain-focused folders:
cli/- Command-line interface and commandscore/- Core processing modules (processor, reporter, reader, source maps)utils/- Shared utilities (config, logger, constants, extractors)worker/- Worker thread parallelizationmerger/- Coverage merging logicconverter/- V8-to-Istanbul conversionparsers/- Bundler-specific URL parserscollector/- Coverage collection (CDP, dev mode, production)playwright/- Playwright test fixtures
- All 686 tests passing with full TypeScript type checking
- No API changes - this is purely an internal code organization improvement
v0.11.0
[0.11.0] - 2024-12-26
Changed
- Refactored converter and parsers into modular structure - Split large monolithic files into focused modules for better maintainability
- Split
converter.ts(2,117 lines) intoconverter/folder with 4 modules:converter/index.ts- Main CoverageConverter class (1,007 lines)converter/merge.ts- V8 coverage merging (82 lines)converter/sanitizer.ts- Source map sanitization (340 lines)converter/coverage-fixes.ts- Istanbul coverage fixes (754 lines)
- Created
parsers/folder (6 modules, 553 lines total):- Extracted bundler-specific patterns from
constants.ts parsers/nextjs.ts- Next.js URL patterns (101 lines)parsers/vite.ts- Vite URL patterns (93 lines)parsers/webpack.ts- Webpack URL patterns (94 lines)parsers/sourcemap.ts- Source map patterns (92 lines)parsers/url-utils.ts- URL utilities (68 lines)
- Extracted bundler-specific patterns from
- Reduced
constants.tsfrom 317 to 92 lines (-71%) - All exports remain backward compatible - no breaking changes for users
- Split
Internal
- Improved test coverage - Added comprehensive tests for new modules (+2,047 test lines)
- Coverage improved from 72.75% to 77.53% (+4.78%)
- Created 9 new test files for parsers and converter modules
- All 678 tests passing
v0.10.1
v0.10.0
[0.10.0] - 2024-12-25
Added
-
nextcov initcommand - Interactive scaffolding for nextcov setup- Creates
global-setup.ts,global-teardown.ts, andtest-fixtures.ts - Modifies
playwright.config.tswith nextcov configuration - Adds npm scripts (
dev:e2e,build:e2e,start:e2e,test:e2e,coverage:merge) topackage.json - Modifies
next.config.tswith E2E mode settings for source maps - Options:
--client-only,--e2e-dir,--js,--force,-y(skip prompts)
- Creates
-
Coverage mode selection in
nextcov init- Choose between Full and Client-only modes- Full mode: Creates
global-setup.tswith server coverage,dev:e2euses--inspect - Client-only mode: Creates
global-setup.tsfor client coverage, simplerdev:e2escript,collectServer: falsein config
- Full mode: Creates
-
initCoverage()function - Unified entry point for globalSetup- Works for both client-only and full (client + server) modes
- Replaces the confusing pattern of calling
startServerCoverage()for client-only mode - Example:
await initCoverage(config)in global-setup.ts
-
Vite support - Client-only coverage for Vite applications
- Detects Vite source URLs (e.g.,
http://localhost:5173/src/App.tsx) - Use
collectServer: falsein nextcov config for Vite apps - Full example in README under "Vite Support" section
- Detects Vite source URLs (e.g.,
-
text-summaryin default reporters - Bothnextcov inittemplates andnextcov mergeCLI now includetext-summaryreporter by default -
Component test coverage in merge script -
coverage:mergescript now includescoverage/componentdirectory- Generated script:
nextcov merge coverage/unit coverage/component coverage/e2e -o coverage/merged
- Generated script:
-
--no-stripoption fornextcov merge- Disable automatic stripping of import statements and directives- By default,
mergestrips import statements and'use client'/'use server'directives for accurate merged coverage - Use
--no-stripto preserve original coverage data
- By default,
Fixed
-
Client-only mode in
nextcov init- Fixed several issues with client-only setupdev:e2escript now correctly usesE2E_MODE=trueinstead of--inspectflag- Global teardown template includes correct comment for client-only mode
- Playwright config correctly sets
collectServer: false
-
Full mode (client + server) in
nextcov init- Fixed server coverage setupstart:localscript includesNODE_V8_COVERAGEfor proper server coverage collection- Webpack config properly handles
isServerparameter for source map paths - Added
devtoolModuleFilenameTemplatefor accurate server-side source mapping
-
Config loading in CJS projects - Fixed
loadNextcovConfig()not loading config fromplaywright.config.tsin projects without"type": "module"in package.json- In CJS projects, named exports like
export const nextcov = {...}appear undermodule.default.nextcovinstead ofmodule.nextcov - Now checks multiple locations:
module.nextcov,module.default?.nextcov, andactualConfig?.nextcov
- In CJS projects, named exports like
v0.9.4
[0.9.4] - 2024-12-24
Added
- Dual ESM/CJS build - Package now exports both ESM and CommonJS formats
- ESM:
dist/index.js,dist/playwright/index.js - CJS:
dist/index.cjs,dist/playwright/index.cjs - Enables compatibility with tools that require CJS (e.g., Playwright's TypeScript loader when using symlinks via yalc/npm link)
- Uses tsup bundler for reliable dual-format output
- ESM:
Changed
- Build system migrated to tsup - Replaced
tscwithtsupfor bundling- Adds
shims: trueforimport.meta.urlcompatibility in CJS - Adds
cjsInterop: truefor proper default export handling - Worker file (
ast-worker.js) built as separate ESM entry
- Adds
Fixed
- Worker path resolution for bundled code -
findWorkerPath()now checks parent directory forast-worker.js- Fixes worker loading when code is bundled into
dist/playwright/subdirectory
- Fixes worker loading when code is bundled into
- ESM/CJS interop for ast-v8-to-istanbul - Added runtime detection to unwrap default export in CJS context
- Fixes
(0, import_ast_v8_to_istanbul.default) is not a functionerror in CJS mode
- Fixes