{"id":50542601,"url":"https://github.com/continuous-delphi/delphi-coverage","last_synced_at":"2026-06-03T21:01:38.231Z","repository":{"id":357508166,"uuid":"1235986830","full_name":"continuous-delphi/delphi-coverage","owner":"continuous-delphi","description":"Code coverage orchestrator - wraps Delphi code coverage engines (DelphiCodeCoverage, radCodeCoverage) behind a unified PowerShell interface with structured output, threshold enforcement, and badge generation","archived":false,"fork":false,"pushed_at":"2026-05-13T03:33:36.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-13T05:22:09.553Z","etag":null,"topics":["build-automation","code-coverage","continuous-delphi","delphi","powershell","pwsh","tooling"],"latest_commit_sha":null,"homepage":"https://github.com/continuous-delphi","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/continuous-delphi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-11T21:02:21.000Z","updated_at":"2026-05-13T03:34:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/continuous-delphi/delphi-coverage","commit_stats":null,"previous_names":["continuous-delphi/delphi-coverage"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/continuous-delphi/delphi-coverage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/continuous-delphi%2Fdelphi-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/continuous-delphi%2Fdelphi-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/continuous-delphi%2Fdelphi-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/continuous-delphi%2Fdelphi-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/continuous-delphi","download_url":"https://codeload.github.com/continuous-delphi/delphi-coverage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/continuous-delphi%2Fdelphi-coverage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33878990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-automation","code-coverage","continuous-delphi","delphi","powershell","pwsh","tooling"],"created_at":"2026-06-03T21:01:37.238Z","updated_at":"2026-06-03T21:01:38.217Z","avatar_url":"https://github.com/continuous-delphi.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# delphi-coverage\n\n![delphi-coverage logo](https://continuous-delphi.github.io/assets/logos/delphi-coverage-480x270.png)\n\n[![Delphi](https://img.shields.io/badge/delphi-red)](https://www.embarcadero.com/products/delphi)\n[![CI](https://github.com/continuous-delphi/delphi-coverage/actions/workflows/ci.yml/badge.svg)](https://github.com/continuous-delphi/delphi-coverage/actions/workflows/ci.yml)\n[![GitHub Release](https://img.shields.io/github/v/release/continuous-delphi/delphi-coverage?display_name=release)](https://github.com/continuous-delphi/delphi-coverage/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/continuous-delphi/delphi-coverage)\n[![Continuous Delphi](https://img.shields.io/badge/org-continuous--delphi-red)](https://github.com/continuous-delphi)\n\nPowerShell code coverage orchestrator for Delphi projects, wrapping coverage engines behind a unified interface.\n\n## Overview\n\n`delphi-coverage` simplifies running Delphi code coverage analysis. It wraps\ncoverage engines (DelphiCodeCoverage, radCodeCoverage) with clean parameters,\nstructured output, threshold enforcement, and badge generation.\n\nDesigned for use as a standalone command or as a bundled tool inside\n[delphi-powershell-ci](https://github.com/continuous-delphi/delphi-powershell-ci).\n\n---\n\n## Running the Tool\n\nIf `delphi-coverage` is on your PATH:\n\n```powershell\ndelphi-coverage -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map -SourceDir source\\\n```\n\nOtherwise, run it directly:\n\n```powershell\npwsh -File .\\source\\delphi-coverage.ps1 -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map -SourceDir source\\\n```\n\n## PowerShell Compatibility\n\nRuns on the widely available Windows PowerShell 5.1 (`powershell.exe`)\nand the newer PowerShell 7+ (`pwsh`).\n\n---\n\n## Features\n\n- Wraps coverage engines behind a unified, documented interface\n- Coverage threshold enforcement with exit code 6 on failure\n- Badge generation (self-contained SVG or Shields.io JSON endpoint)\n- MAP file validation (detects segment-only maps before running)\n- Structured JSON output via `-OutputFile` for CI integration\n- Multiple source directories via comma-separated `-SourceDir`\n\n---\n\n## Supported Engines\n\n| Engine | Status | Notes |\n|--------|--------|-------|\n| `DelphiCodeCoverage` | Supported | Open source, Win32/Win64, MAP-file based |\n| `radCodeCoverage` | Supported | Shares DelphiCodeCoverage CLI conventions, adds markdown, LCOV, and covdb output |\n| `CoverageValidator` | Future | Commercial (Software Verify) |\n\n---\n\n## -Execute / -MapFile (explicit mode)\n\nPath to the test executable and its detailed MAP file. Both are required unless `-Dproj` is used.\n\n```powershell\ndelphi-coverage -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map\n```\n\n---\n\n## -Dproj (auto-discovery mode)\n\nPass a `.dproj` file and the engine auto-discovers the executable, MAP file,\nunits, and source paths. \n\nWhen `-Dproj` is provided, `-Execute` and `-MapFile` are not required.\nAdditional `-SourceDir`, `-Units`, and `-ExcludeUnits` flags supplement\nwhat the engine discovers.\n\n```powershell\ndelphi-coverage -Dproj test\\MyApp.Tests.dproj\ndelphi-coverage -Dproj test\\MyApp.Tests.dproj -Engine radCodeCoverage\n```\n\n---\n\n## -Engine\n\nWhich coverage engine to use. Default: `DelphiCodeCoverage`.\n\nThe engine executable must be on PATH or specified via `-EnginePath`.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Engine radCodeCoverage\n```\n\n---\n\n## -EnginePath\n\nExplicit path to the coverage engine executable. Overrides PATH discovery.\nUse this for platform-specific variants (e.g., `CodeCoverage.x64.exe` or\n`radCodeCoverage.x64.exe`).\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map `\n    -EnginePath C:\\tools\\radCodeCoverage.x64.exe\n```\n\n---\n\n## -SourceDir\n\nDirectories containing Delphi source files, passed as comma-separated\nvalues. Each path gets a separate `-sp` flag when invoking the engine.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -SourceDir source\\,lib\\\n```\n\n---\n\n## -Units\n\nUnit name patterns to include in coverage measurement. Supports wildcards.\nComma-separated when passed via `-File` mode. When empty, all units are\nincluded.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -SourceDir source\\ `\n    -Units MyApp.Core.*,MyApp.Utils.*\n```\n\n---\n\n## -ExcludeUnits\n\nUnit name patterns to exclude from coverage measurement. Comma-separated\nwhen passed via `-File` mode.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -SourceDir source\\ `\n    -Units MyApp.* -ExcludeUnits MyApp.Generated.*\n```\n\n---\n\n## -OutputDir\n\nDirectory for coverage reports. Default: `coverage/`. Created automatically\nif it does not exist.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -OutputDir reports\\coverage\n```\n\n---\n\n## -Formats\n\nOutput format(s) for coverage reports. Default: `html`. Comma-separated\nwhen specifying multiple formats.\n\n| Format | Description |\n|--------|-------------|\n| `html` | Human-readable HTML report |\n| `xml` | DelphiCodeCoverage XML format |\n| `emma` | Emma XML format |\n| `lcov` | LCOV tracefile format (for Codecov, Coveralls, genhtml) |\n| `cobertura` | Cobertura XML format (for CI tools) |\n| `md` | Markdown coverage report |\n| `covdb` | SQLite coverage database (radCodeCoverage only) |\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Formats html,lcov,md\n```\n\nThe `covdb` format produces a `coverage.db` SQLite database with three tables:\n- **metadata** -- key/value pairs (format_version, tool_name, run dates, exe/map paths, overall stats)\n- **files** -- one row per unit (file_name, sha256, total/covered lines, coverage_pct)\n- **lines** -- one row per instrumented line (file_id, line_number, hit_count)\n\nThis format requires `-Engine radCodeCoverage`.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Engine radCodeCoverage -Formats html,covdb\n```\n\n---\n\n## -Threshold\n\nMinimum coverage percentage required. When set to a value greater than 0,\nthe tool fails (exit code 6) if coverage is below the threshold.\n\n```powershell\n# Fail if coverage drops below 60%\ndelphi-coverage -Execute test.exe -MapFile test.map -Threshold 60\n```\n\nDefault: `0` (disabled -- any coverage percentage passes).\n\n---\n\n## -Arguments\n\nExtra command-line arguments passed to the test executable at runtime.\nComma-separated when passed via `-File` mode.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Arguments -b,-l:Warning\n```\n\n---\n\n## -TimeoutSeconds\n\nMaximum time in seconds for the coverage run. If exceeded, the engine\nprocess is killed and the step fails. Default: `300`.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -TimeoutSeconds 600\n```\n\n---\n\n## -Badge\n\nGenerates a coverage badge file. The output format is determined by the\nfile extension.\n\n### SVG Badge\n\nSelf-contained SVG with no external dependencies. Commit it to the repo\nor host on GitHub Pages.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Badge docs/coverage-badge.svg\n```\n\nREADME usage:\n```markdown\n![coverage](docs/coverage-badge.svg)\n```\n\n### Shields.io JSON\n\nJSON file in Shields.io's endpoint schema. Host it and reference with a\ndynamic badge URL.\n\n```powershell\ndelphi-coverage -Execute test.exe -MapFile test.map -Badge docs/coverage.json\n```\n\nREADME usage:\n```markdown\n![coverage](https://img.shields.io/endpoint?url=https://yourhost.com/coverage.json)\n```\n\n### Color Thresholds\n\n| Coverage | Color |\n|----------|-------|\n| \u003e= 80% | green |\n| \u003e= 60% | yellow |\n| \u003c 60% | red |\n\n---\n\n## -OutputFile\n\nPath to write a structured JSON result file for CI tool integration.\n\n```json\n{\n  \"engine\": \"radCodeCoverage\",\n  \"execute\": \"test/Win64/Debug/MyApp.Tests.exe\",\n  \"exitCode\": 0,\n  \"success\": true,\n  \"coveragePercent\": 73.4,\n  \"linesCovered\": 1842,\n  \"linesTotal\": 2510,\n  \"threshold\": 60,\n  \"thresholdMet\": true,\n  \"outputDir\": \"coverage/\",\n  \"formats\": [\"html\", \"lcov\"],\n  \"badge\": \"docs/coverage-badge.svg\",\n  \"duration\": 12.3\n}\n```\n\n---\n\n## Exit Codes\n\n```text\n  0 = success: coverage run completed, threshold met (or no threshold set)\n  1 = unexpected error\n  2 = invalid arguments (missing params, bad format, segment-only MAP file)\n  3 = engine executable not found\n  4 = test executable, MAP file, or .dproj not found\n  5 = coverage run failed (engine exited non-zero)\n  6 = threshold not met (coverage below minimum percentage)\n```\n\n---\n\n## Examples\n\n### Basic coverage run\n\n```powershell\ndelphi-coverage -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map `\n    -SourceDir source\\\n```\n\n### Using -Dproj with radCodeCoverage\n\n```powershell\ndelphi-coverage -Dproj test\\MyApp.Tests.dproj `\n    -Engine radCodeCoverage `\n    -EnginePath radCodeCoverage.x64.exe `\n    -Formats html,lcov,md `\n    -Badge assets/coverage/coverage-badge.svg\n```\n\n### Multiple source directories\n\n```powershell\ndelphi-coverage -Execute test\\Win64\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win64\\Debug\\MyApp.Tests.map `\n    -SourceDir source\\,lib\\,shared\\\n```\n\n### With threshold and LCOV output\n\n```powershell\ndelphi-coverage -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map `\n    -SourceDir source\\ -Units MyApp.* `\n    -OutputDir coverage\\ -Formats html,lcov `\n    -Threshold 60\n```\n\n### With badge generation\n\n```powershell\ndelphi-coverage -Execute test\\Win32\\Debug\\MyApp.Tests.exe `\n    -MapFile test\\Win32\\Debug\\MyApp.Tests.map `\n    -SourceDir source\\ -Badge assets/coverage/coverage-badge.svg\n```\n\n### Full pipeline example (via delphi-powershell-ci config)\n\n```json\n{\n  \"pipeline\": [\n    { \"action\": \"Build\", \"jobs\": [\n      { \"name\": \"Test project\",\n        \"projectFile\": \"test/MyApp.Tests.dproj\",\n        \"platform\": \"Win64\", \"configuration\": \"Debug\",\n        \"defines\": [\"CI\"] }\n    ]},\n    { \"action\": \"Coverage\", \"jobs\": [\n      { \"name\": \"Unit test coverage\",\n        \"dproj\": \"test/MyApp.Tests.dproj\",\n        \"engine\": \"radCodeCoverage\",\n        \"sourceDir\": [\"/source\", \"/lib\"],\n        \"formats!\": [\"html\", \"lcov\", \"md\"],\n        \"threshold\": 60,\n        \"badge\": \"assets/coverage/coverage-badge.svg\" }\n    ]}\n  ]\n}\n```\n\n---\n\n## Build Prerequisites\n\nCoverage requires the test project to be built with:\n- **Debug information** enabled\n- **Detailed MAP file** output (linker setting \"Detailed\" or `DCC_MapFile=3`)\n\nWithout these, the coverage engine cannot map execution to source lines.\n\nWhen using `-Dproj` mode, the engine reads these settings from the project\nfile directly.\n\n---\n\n## Running Tests\n\nRequires PowerShell 7+, Pester 5.7+, and PSScriptAnalyzer.\n\n```powershell\n./tests/run-tests.ps1\n```\n\n---\n\n## Continuous-Delphi\n\nThis tool is part of the [Continuous-Delphi](https://github.com/continuous-delphi)\necosystem, focused on strengthening Delphi's continued success.\n\n![continuous-delphi logo](https://continuous-delphi.github.io/assets/logos/continuous-delphi-480x270.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontinuous-delphi%2Fdelphi-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontinuous-delphi%2Fdelphi-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontinuous-delphi%2Fdelphi-coverage/lists"}