Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yaegassy/coc-vitest
Vitest for coc.nvim
https://github.com/yaegassy/coc-vitest
coc coc-extensions coc-nvim neovim vim vitest
Last synced: 10 days ago
JSON representation
Vitest for coc.nvim
- Host: GitHub
- URL: https://github.com/yaegassy/coc-vitest
- Owner: yaegassy
- License: mit
- Created: 2022-03-14T05:57:59.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-06T23:51:19.000Z (over 1 year ago)
- Last Synced: 2024-11-01T15:37:07.569Z (17 days ago)
- Topics: coc, coc-extensions, coc-nvim, neovim, vim, vitest
- Language: TypeScript
- Homepage:
- Size: 224 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coc-vitest
[Vitest](https://github.com/vitest-dev/vitest) for [coc.nvim](https://github.com/neoclide/coc.nvim)
![coc-vitest-demo](https://user-images.githubusercontent.com/188642/158115056-55710c75-cf08-4eb0-82a1-3c1337b16b99.gif)
## Install
**CocInstall**:
```vim
:CocInstall @yaegassy/coc-vitest
```> scoped packages
**vim-plug**:
```vim
Plug 'yaegassy/coc-vitest', {'do': 'yarn install --frozen-lockfile'}
```## Configuration options
- `vitest.enable`: Enable coc-vitest extension, default: `true`
- `vitest.terminal.enableSplitRight`: Use vertical belowright for vitest terminal window, default: `false`
- `vitest.codelens.enable`: Enable codelens, default: `true`
- `vitest.codelens.title`: CodeLens title. Can be changed to any display, default: `">> [Run Vitest]"`
- `vitest.watch`: Run tests in watch mode, default: `false`## Commands
> :CocCommand [CommandName]
>
> **e.g.**:
> :CocCommand vitest.projectTest- `vitest.projectTest`: Run Vitest for current project
- `vitest.fileTest`: Run Vitest for current file
- `vitest.singleTest`: Run Vitest for single (nearest) test**Example of Vim command and key mapping**:
Vim commands can be defined and executed or key mappings can be set and used.
```vim
" Run Vitest for current project
command! -nargs=0 Vitest :call CocAction('runCommand', 'vitest.projectTest')" Run Vitest for current file
command! -nargs=0 VitestCurrent :call CocAction('runCommand', 'vitest.fileTest', ['%'])" Run Vitest for single (nearest) test
nnoremap te :call CocAction('runCommand', 'vitest.singleTest')
```## CodeLens (Neovim only)
**Feature**:
CodeLens appears above the test name in the `*.test.ts` and `*.spec.ts` files. Currently, `import.meta.vitest` is not supported.
**coc-settings.json**:
By default, `codeLens.enable` is set to `false`, which disables it.
Change the setting to `true` to enable it.
```jsonc
{
"codeLens.enable": true
}
```**Example key mapping (CodeLens related)**:
```vim
nmap gl (coc-codelens-action)
```**Misc**:
"CodeLens" does not work with "Vim8" due to coc.nvim specifications.
`vitest.singleTest` commands are available, so please use them.
## Similar coc.nvim extension
- [coc-jest](https://github.com/neoclide/coc-jest)
## Thanks
- [vitest-dev/vitest](https://github.com/vitest-dev/vitest)
- [jest-community/jest-editor-support](https://github.com/jest-community/jest-editor-support)## License
MIT
---
> This extension is built with [create-coc-extension](https://github.com/fannheyward/create-coc-extension)