UNPKG

@scintilla-network/litest

Version:

Dependency-free test framework with full Vitest API compatibility. Zero-dependency replacement for Vitest to reduce risk of supply chain attacks.

101 lines (81 loc) • 2.52 kB
/** * Code coverage reporting for litest (placeholder implementation) * * This module provides code coverage capabilities. * Currently shows a professional "coming soon" message with alternatives. */ import { c } from './colors.js'; /** * Generate coverage report * @param {Object} options - Coverage options * @param {string[]} options.files - Files to analyze * @param {string} options.reporter - Reporter type (html, lcov, text) */ function generateCoverageReport(options = {}) { console.log(c.bold('\nšŸ“Š Code Coverage')); console.log(c.muted('━'.repeat(50))); console.log(` ${c.yellow('āš ļø Built-in coverage is coming in a future release!')} ${c.bold('Planned Features:')} ${c.green('•')} Line, branch, and function coverage ${c.green('•')} HTML, LCOV, and text reporters ${c.green('•')} Coverage thresholds and enforcement ${c.green('•')} Exclude patterns for generated files ${c.green('•')} Integration with CI/CD pipelines ${c.bold('Current Alternative - Using c8:')} ${c.muted('# Install c8 (v8 coverage)')} ${c.green('npm install --save-dev c8')} ${c.muted('# Add to package.json scripts:')} ${c.green('"test:coverage": "c8 litest"')} ${c.muted('# Run with coverage')} ${c.green('npm run test:coverage')} ${c.muted('# Generate HTML report')} ${c.green('c8 --reporter=html litest')} ${c.bold('Alternative - Using nyc:')} ${c.muted('# Install nyc')} ${c.green('npm install --save-dev nyc')} ${c.muted('# Run with coverage')} ${c.green('nyc litest')} ${c.bold('Example c8 configuration (.c8rc.json):')} ${c.muted(`{ "include": ["src/**/*.js"], "exclude": ["**/*.spec.js", "**/*.test.js"], "reporter": ["text", "html", "lcov"], "check-coverage": true, "lines": 80, "functions": 80, "branches": 80, "statements": 80 }`)} ${c.bold('Track Progress:')} ${c.blue('https://github.com/Alex-Werner/litest/issues')} `); process.exit(0); } /** * Check if coverage is supported * @returns {boolean} Always false for now */ function isCoverageSupported() { return false; } /** * Initialize coverage collection */ function initializeCoverage() { // Placeholder for future implementation return null; } /** * Finalize coverage collection and generate report */ function finalizeCoverage() { // Placeholder for future implementation return null; } export { generateCoverageReport, isCoverageSupported, initializeCoverage, finalizeCoverage };