Awesome
nvim-lspconfig-test
NOTE: this repo is currently under review before upstreaming to nvim-lua
-- please wait until then to contribute!
Tests for configurations implemented in neovim/nvim-lspconfig
.
This repo's tests are run on a nightly basis, and config-specific issues are created/closed automatically when tests fail/pass.
Why test?
Much like neovim/nvim-lspconfig
, this repo is community-driven. We highly recommend adding tests for your language server to it! Doing so will:
- Protect your config from changes to
neovim/nvim-lspconfig
, as we will run these tests to make sure we don't break anything - Because of the above, make fixes/refactoring easier on our end
- Let you know automatically when/if your language server (or something else) changes which breaks compatability with
nvim
along with all of the other benefits of having well-tested code!
Adding tests
- In
.github/workflows/default.yml
, add the name of your config tojobs.default.strategy.matrix.config
. - Create a folder with your language server's name in the
tests/
directory. - Add the following files to it:
issue_body
: the body of the issue that will be automatically created if your tests fail. Feel free to @ yourself and other maintainers here.setup.sh
: code to set up your language server on a new machine. This should "formalize" the steps described in CONFIG.md for your language server. Seetests/leanls/setup.sh
for an example.test.sh
: code that actually runs your tests. This should exit 0 iff all of your tests succeed. Seetests/leanls/test.sh
for an example. As done there, we recommend usingnvim-lua/plenary.nvim
'sbusted
-style testing to write these tests (seetests/leanls/tests/lsp_spec.lua
), initializing with the givenminimal_init.lua
. Some helper functions are provided innvim-lspconfig-test/lua/test/helpers.lua
(available to your tests viarequire'test.helpers'
).
Running locally
Assuming all of your language server's necessary software is installed, just do:
TEST=<test_name> make test
where <test_name>
is the name of your config.
Contributing
Feel free to make a PR title-prefixed with [WIP]
as soon as you start working on your tests. Remove the [WIP]
when you're ready for review.
Fixing problems
An issue titled for your language server will automatically be created if your tests fail on a run. Do not close these issues manually! They will be automatically closed on a subsequent run where your tests pass.