{"id":13412608,"url":"https://github.com/andythigpen/nvim-coverage","last_synced_at":"2026-01-02T03:48:50.548Z","repository":{"id":40449526,"uuid":"463950313","full_name":"andythigpen/nvim-coverage","owner":"andythigpen","description":"Displays test coverage data in the sign column","archived":false,"fork":false,"pushed_at":"2024-05-14T14:50:32.000Z","size":197,"stargazers_count":300,"open_issues_count":12,"forks_count":34,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-07-31T20:51:10.391Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/andythigpen.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-02-26T19:45:00.000Z","updated_at":"2024-07-29T07:35:27.000Z","dependencies_parsed_at":"2023-02-12T12:31:35.509Z","dependency_job_id":"5e0e31f0-7285-48c2-b9bb-511180da2f47","html_url":"https://github.com/andythigpen/nvim-coverage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andythigpen%2Fnvim-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andythigpen%2Fnvim-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andythigpen%2Fnvim-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andythigpen%2Fnvim-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andythigpen","download_url":"https://codeload.github.com/andythigpen/nvim-coverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243625153,"owners_count":20321241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-30T20:01:26.731Z","updated_at":"2026-01-02T03:48:50.508Z","avatar_url":"https://github.com/andythigpen.png","language":"Lua","readme":"# nvim-coverage\n\nDisplays coverage information in the sign column.\n\n![markers](https://user-images.githubusercontent.com/542263/159128715-32e6eddf-5f9f-4853-9e2b-abd66bbf01d4.png)\n\nDisplays a coverage summary report in a pop-up window.\n\n![summary](https://user-images.githubusercontent.com/542263/159128732-8189b89d-4f71-4a34-8c6a-176e40fcd48d.png)\n\nCurrently supports:\n\n- C/C++ (lcov)\n- C# (lcov - see wiki for details)\n- Dart (lcov)\n- Go (coverprofile)\n- Javascript/Typescript (lcov): [jest](https://jestjs.io/docs/getting-started)\n- Julia (lcov): [Pkg.jl](https://pkgdocs.julialang.org/v1/)\n- Python (json): [coverage.py](https://coverage.readthedocs.io/en/6.3.2/index.html)\n- Ruby (json): [SimpleCov](https://github.com/simplecov-ruby/simplecov)\n- Rust (json): [grcov](https://github.com/mozilla/grcov#usage)\n- Swift (json)\n- PHP (cobertura)\n- Lua (lcov)\n- Anything that generates lcov files\n\nBranch (partial) coverage support:\n\n| Language              | Supported              |\n| --------------------- | ---------------------- |\n| C/C++                 | :x: |\n| C#                    | :x: |\n| Dart                  | :heavy_check_mark: (untested) |\n| Go                    | :x: |\n| Javascript/Typescript | :heavy_check_mark: |\n| Julia                 | :heavy_check_mark: (untested) |\n| Python                | :heavy_check_mark: |\n| Ruby                  | :x: |\n| Rust                  | :x: |\n| Swift                 | :x: |\n| PHP                   | :x: |\n| Lua                   | :x: |\n\n*Note:* This plugin does not run tests. It justs loads/displays a coverage report generated by a test suite.\nTo run tests from neovim with coverage enabled, try one of these plugins:\n\n* [neotest](https://github.com/nvim-neotest/neotest)\n* [vim-test](https://github.com/vim-test/vim-test)\n\n## Installation\n\nThis plugin depends on [plenary](https://github.com/nvim-lua/plenary.nvim) and optionally on the\n[lua-xmlreader](https://luarocks.org/modules/luarocks/lua-xmlreader) luarock to parse the cobertura format.\n\nUsing vim-plug (not including the luarock dependency):\n```vim\nPlug 'nvim-lua/plenary.nvim'\nPlug 'andythigpen/nvim-coverage'\n```\n\nThe following lua is required to configure the plugin after installation.\n```lua\nrequire(\"coverage\").setup()\n```\n\nUsing packer:\n```lua\nuse({\n  \"andythigpen/nvim-coverage\",\n  requires = \"nvim-lua/plenary.nvim\",\n  -- Optional: needed for PHP when using the cobertura parser\n  rocks = { 'lua-xmlreader' },\n  config = function()\n    require(\"coverage\").setup()\n  end,\n})\n```\n\nUsing lazyvim:\n```lua\n {\n    \"andythigpen/nvim-coverage\",\n    version = \"*\",\n    config = function()\n      require(\"coverage\").setup({\n        auto_reload = true,\n      })\n    end,\n  },\n```\n\n## Configuration\n\nSee [docs](https://github.com/andythigpen/nvim-coverage/blob/main/doc/nvim-coverage.txt) for more info.\n\nExample:\n\n```lua\nrequire(\"coverage\").setup({\n\tcommands = true, -- create commands\n\thighlights = {\n\t\t-- customize highlight groups created by the plugin\n\t\tcovered = { fg = \"#C3E88D\" },   -- supports style, fg, bg, sp (see :h highlight-gui)\n\t\tuncovered = { fg = \"#F07178\" },\n\t},\n\tsigns = {\n\t\t-- use your own highlight groups or text markers\n\t\tcovered = { hl = \"CoverageCovered\", text = \"▎\" },\n\t\tuncovered = { hl = \"CoverageUncovered\", text = \"▎\" },\n\t},\n\tsummary = {\n\t\t-- customize the summary pop-up\n\t\tmin_coverage = 80.0,      -- minimum coverage threshold (used for highlighting)\n\t},\n\tlang = {\n\t\t-- customize language specific settings\n\t},\n})\n```\n\n## Extending to other languages\n\n1. Create a new lua module matching the pattern `coverage.languages.\u003cfiletype\u003e` where `\u003cfiletype\u003e` matches the vim filetype for the coverage language (ex. python).\n2. Implement the required methods listed below.\n\nRequired methods:\n```lua\nlocal M = {}\n\n--- Loads a coverage report.\n-- This method should perform whatever steps are necessary to generate a coverage report.\n-- The coverage report results should passed to the callback, which will be cached by the plugin.\n-- @param callback called with results of the coverage report\nM.load = function(callback)\n  -- TODO: callback(results)\nend\n\n--- Returns a list of signs that will be placed in buffers.\n-- This method should use the coverage data (previously generated via the load method) to \n-- return a list of signs.\n-- @return list of signs\nM.sign_list = function(data)\n  -- TODO: generate a list of signs using:\n  -- require(\"coverage.signs\").new_covered(bufnr, linenr)\n  -- require(\"coverage.signs\").new_uncovered(bufnr, linenr)\nend\n\n--- Returns a summary report.\n-- @return summary report\nM.summary = function(data)\n  -- TODO: generate a summary report in the format\n  return {\n    files = {\n      { -- all fields, except filename, are optional - the report will be blank if the field is nil\n        filename = fname,            -- filename displayed in the report\n        statements = statements,     -- number of total statements in the file\n        missing = missing,           -- number of lines missing coverage (uncovered) in the file\n        excluded = excluded,         -- number of lines excluded from coverage reporting in the file\n        branches = branches,         -- number of total branches in the file\n        partial = partial_branches,  -- number of branches that are partially covered in the file\n        coverage = coverage,         -- coverage percentage (float) for this file\n      }\n    },\n    totals = { -- optional\n      statements = total_statements,     -- number of total statements in the report\n      missing = total_missing,           -- number of lines missing coverage (uncovered) in the report\n      excluded = total_excluded,         -- number of lines excluded from coverage reporting in the report\n      branches = total_branches,         -- number of total branches in the report\n      partial = total_partial_branches,  -- number of branches that are partially covered in the report\n      coverage = total_coverage,         -- coverage percentage to display in the report\n    }\n  }\nend\n\nreturn M\n```\n","funding_links":[],"categories":["Test","Lua"],"sub_categories":["Quickfix"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandythigpen%2Fnvim-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandythigpen%2Fnvim-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandythigpen%2Fnvim-coverage/lists"}