TheJoeSchr / continuous-testing.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

continuous-testing.nvim

Run tests async on save, add to diagnostics, get notified on failures.

Inspired by teejdv - Integrated Test Results.

๐Ÿ“ Description

  • 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!

Screenshots

Attach test

Test Setup

Failed test

Test Failure

Passed tests

Test Success

โš™๏ธ Installation

Plugin manager

  • Packer
return require('packer').startup(function(use)
    use 'aaronhallaert/continuous-testing.nvim'
end)
  • Lazy.nvim
{'aaronhallaert/continuous-testing.nvim'}

Dependencies

Config

-- %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",
            },
        },
    },
}

Supported Test Frameworks

Rspec (Ruby)

  • Make sure rubocop is installed. This is used to check for breakpoints.

Vitest (Javascript, Typescript ...)

๐Ÿ‹๏ธโ€โ™€๏ธ Usage

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

๐Ÿ›  Developers

See vim-docs and inline documentation for more info.

TODO

  • Migrate autocmd filetype triggers to config

About


Languages

Language:Lua 99.2%Language:Makefile 0.5%Language:Vim Script 0.3%