{"id":13898962,"url":"https://github.com/kana/vim-vspec","last_synced_at":"2025-04-13T05:05:23.527Z","repository":{"id":826116,"uuid":"541173","full_name":"kana/vim-vspec","owner":"kana","description":"Vim plugin: Testing framework for Vim script","archived":false,"fork":false,"pushed_at":"2025-03-11T02:26:10.000Z","size":437,"stargazers_count":223,"open_issues_count":12,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-13T05:04:48.148Z","etag":null,"topics":["testing-framework","vim","vim-plugins"],"latest_commit_sha":null,"homepage":"http://www.vim.org/scripts/script.php?script_id=3012","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2010-03-01T13:21:01.000Z","updated_at":"2025-03-29T16:50:06.000Z","dependencies_parsed_at":"2024-12-04T02:05:22.780Z","dependency_job_id":"f2b7eed1-afe1-4f98-8b06-57f6c9c81480","html_url":"https://github.com/kana/vim-vspec","commit_stats":{"total_commits":390,"total_committers":6,"mean_commits":65.0,"dds":"0.12051282051282053","last_synced_commit":"4438b57f85ba25d67143fe2d0c95cfa958fb7b94"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kana%2Fvim-vspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kana%2Fvim-vspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kana%2Fvim-vspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kana%2Fvim-vspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kana","download_url":"https://codeload.github.com/kana/vim-vspec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665748,"owners_count":21142123,"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":["testing-framework","vim","vim-plugins"],"created_at":"2024-08-06T18:04:33.503Z","updated_at":"2025-04-13T05:05:23.485Z","avatar_url":"https://github.com/kana.png","language":"Vim Script","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# vim-vspec - A testing framework for Vim script\n\n[![CI](https://github.com/kana/vim-vspec/actions/workflows/ci.yml/badge.svg)](https://github.com/kana/vim-vspec/actions/workflows/ci.yml)\n\nvim-vspec is a testing framework for Vim script.  It consists of:\n\n* Utilities to run tests in an isolated Vim process,\n* A testing framework to write tests in a format which resembles [RSpec](https://rspec.info/), and\n* Additional syntax/indent files for Vim script to write tests.\n\nA typical test script written with vim-vspec looks like as follows:\n\n```vim\nruntime plugin/MyGitUtilities.vim\n\ndescribe 'GetGitBranchName()'\n  before\n    call delete('tmp/test', 'rf')\n    call mkdir('tmp/test', 'p')\n    cd tmp/test\n  end\n\n  after\n    cd -\n  end\n\n  context 'in a non-Git directory'\n    it 'returns \"-\"'\n      Expect GetGitBranchName('.') ==# '-'\n    end\n  end\n\n  context 'in a Git repository'\n    before\n      !git init \u0026\u0026 touch foo \u0026\u0026 git add foo \u0026\u0026 git commit -m 'Initial commit'\n    end\n\n    it 'returns the current branch'\n      Expect GetGitBranchName('.') ==# 'master'\n    end\n\n    it 'detects detached HEAD state'\n      !git checkout master~0\n      Expect GetGitBranchName('.') ==# 'master~0'\n    end\n  end\nend\n```\n\nTypical ways to run tests are as follows:\n\n```bash\n# Run tests in a specific file.\n# The current directory is injected into \u0026rutimepath before running tests.\n$PATH_TO_VSPEC/bin/prove-vspec -d $PWD t/branch.vim\n\n# Like the above, but run all tests in all files under the `t` directory.\n$PATH_TO_VSPEC/bin/prove-vspec -d $PWD t/\n\n# Like the above, but you may omit `t` because it's the default target.\n$PATH_TO_VSPEC/bin/prove-vspec -d $PWD\n```\n\nIts output looks like as follows:\n\n```\nt/branch.vim .. ok\nAll tests successful.\nFiles=1, Tests=3,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.07 cusr  0.11 csys =  0.20 CPU)\nResult: PASS\n```\n\n`prove-vspec` runs a test script in an isolated Vim process, and show\na summary like the above.  User-specific configurations, like `~/.vimrc` and\nfiles in `~/.vim`, will never be used to avoid unintentional dependencies.\n\nFor proper testing, you have to set up environment to run tests.  Suppose that\nyou want to test a plugin which depends on some other plugins, you have to:\n\n* Install such dependencies to somewhere, and\n* Specify where the dependencies are installed to run tests.\n\nThese steps are tedious to do by hand.  It is recommended to use\n[vim-flavor](https://github.com/kana/vim-flavor) to automate such tasks.\nSee [How to set up GitHub Actios as CI for Vim plugin development](./TUTORIAL-CI.md) for details.\n\n## Further reading\n\n* [A tutorial to use vim-vspec by Vimcasts.org](http://vimcasts.org/episodes/an-introduction-to-vspec/)\n* [Introduce unit testing to Vim plugin development with vim-vspec](https://whileimautomaton.net/2013/02/13211500)\n* [How to set up GitHub Actios as CI for Vim plugin development](./TUTORIAL-CI.md)\n\n\u003c!-- vim: set expandtab shiftwidth=4 softtabstop=4 textwidth=78 : --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkana%2Fvim-vspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkana%2Fvim-vspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkana%2Fvim-vspec/lists"}