coverage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Coverage Check

覆盖率检查

Context

背景

Run in parallel:
  • git diff --name-only
    - get unstaged files
  • git diff -U0 --no-color
    - get changed line numbers
并行执行:
  • git diff --name-only
    - 获取未暂存文件
  • git diff -U0 --no-color
    - 获取变更行号

Commands

命令

Sequential:
  1. npm run test:ci
    - vitest with coverage
  2. npm run coverage:report
    - generate lcov/text reports
按顺序执行:
  1. npm run test:ci
    - 带覆盖率统计的vitest
  2. npm run coverage:report
    - 生成lcov/文本格式报告

Workflow

工作流程

  1. Get unstaged files and line ranges (parallel):
    • git diff --name-only
    • git diff -U0 --no-color
  2. Run coverage:
    • npm run test:ci
    • npm run coverage:report
  3. Parse
    coverage/lcov.info
    (see
    lcov-format.md
    for format details)
  4. Map changed lines to coverage data
  5. Report uncovered lines:
    file.ts:42
  6. Summary: X/Y changed lines covered
  1. 获取未暂存文件和行范围(并行执行):
    • git diff --name-only
    • git diff -U0 --no-color
  2. 运行覆盖率统计:
    • npm run test:ci
    • npm run coverage:report
  3. 解析
    coverage/lcov.info
    (格式细节参考
    lcov-format.md
  4. 将变更行映射到覆盖率数据
  5. 报告未覆盖的行:
    file.ts:42
  6. 汇总:X/Y行变更已覆盖

Rules

规则

  • Only analyze unstaged changes (
    git diff
    )
  • Use sequential commands:
    test:ci
    then
    coverage:report
  • Parse lcov.info for coverage data
  • Report uncovered lines:
    file.ts:42
  • Ignore files without coverage data (non-code files)
  • 仅分析未暂存变更(
    git diff
  • 使用顺序命令:先
    test:ci
    coverage:report
  • 解析lcov.info获取覆盖率数据
  • 报告未覆盖的行:
    file.ts:42
  • 忽略无覆盖率数据的文件(非代码文件)