Run tests async on save, add to diagnostics, get notified on failures.
Inspired by teejdv - Integrated Test Results.
- Attach a test you want to execute every time you save a file.
- Open a floating window with the output of a failing test.
- Show diagnostics based on test results.
- Show vim-signs based on test results.
- Get notified when the tests are finished.
- Specify your own test command for each project!
- Packer
return require('packer').startup(function(use)
use 'aaronhallaert/continuous-testing.nvim'
end)
- Lazy.nvim
{'aaronhallaert/continuous-testing.nvim'}
-- %file will be replace with the test file
require("continuous-testing").setup {
notify = true, -- The default is false
run_tests_on_setup = true, -- The default is true, run test on attach
framework_setup = {
ruby = {
test_tool = "rspec",
test_cmd = "bundle exec rspec %file",
},
javascript = {
test_tool = "vitest", -- cwd of the executing test will be at package.json
test_cmd = "yarn vitest run %file",
root_pattern = "tsconfig.json", -- used to populate the root option of vitest
},
},
project_override = {
["/Users/name/Developer/ruby-project"] = {
ruby = {
test_tool = "rspec",
test_cmd = "docker exec -it name -- bundle exec rspec %file",
},
},
},
}
- Make sure rubocop is installed. This is used to check for breakpoints.
Multiple test files can be attached to the continuous testing plugin.
Command | Usage | Behaviour |
---|---|---|
CTAttach | When current buffer is a test file | Add current buffer to start tests on save |
CTDialog | On line of failure | Show output of failed test in floating window |
CTDetach | Anywhere in vim when continuous testing is enabled | Stops the continuous testing |
CTOverview | Anywhere in vim | List the attached tests in a telescope window |
CTSingleRun | Anywhere in vim | List the attached test instances in a telescope window press enter to run in a terminal |
See vim-docs and inline documentation for more info.
- Migrate autocmd filetype triggers to config