jrc2139 / dester

A Neovim plugin to easily run and debug Dart tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dester

A Neovim plugin to easily run and debug Jest tests.

dester

Installation

Requirements: Neovim >= 0.5, nvim-treesitter, for debugging nvim-dap.

Make sure that the JavaScript/TypeScript parser for nvim-treesitter is installed and enabled.

For vim-plug:

Plug 'David-Kunz/dester'

For packer:

use 'David-Kunz/dester'

Usage

Run nearest test(s) under the cursor

:lua require"dester".run()

Run current file

:lua require"dester".run_file()

Run last test(s)

:lua require"dester".run_last()

Debug nearest test(s) under the cursor

:lua require"dester".debug()

Debug current file

:lua require"dester".debug_file()

Debug last test(s)

:lua require"dester".debug_last()

Options

You can specify global options using the setup function.

Example:

require("dester").setup({
  dap = {
    console = "externalTerminal"
  }
})

These are the defaults:

{
  cmd = "flutter test -t '$result' -- $file", -- run command
  identifiers = {"testWidgets", "testGoldens"}, -- used to identify tests
  prepend = {"group"}, -- prepend describe blocks
  expressions = {"call_expression"}, -- tree-sitter object used to scan for tests/describe blocks
  path_to_jest_run = 'fluter test' -- used to run tests
  path_to_jest_debug = 'flutter test' -- used for debugging
  terminal_cmd = ":vsplit | terminal" -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config
  dap = { -- debug adapter configuration
    type = 'node2',
    request = 'launch',
    cwd = vim.fn.getcwd(),
    runtimeArgs = {'--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file'},
    args = { '--no-cache' },
    sourceMaps = 'inline',
    protocol = 'inspector',
    skipFiles = {'<node_internals>/**/*.js'},
    console = 'integratedTerminal',
    port = 9229,
    disableOptimisticBPs = true
  }
}

You can also overwrite the options for each function call, for example

:lua require"dester".debug({ dap = { console = "externalTerminal" } })

About

A Neovim plugin to easily run and debug Dart tests

License:The Unlicense


Languages

Language:Lua 100.0%