mirror of
https://github.com/ivuorinen/nvim-shellspec.git
synced 2026-01-26 03:24:00 +00:00
- Replace static test fixture files with dynamic test generation - Implement comprehensive test suite with unit, integration, and golden master tests - Add vim API mocking for standalone Lua test execution - Fix pre-commit hook interference by eliminating external fixture files - Add StyLua formatting for consistent Lua code style - Enhance ShellSpec formatting with improved HEREDOC and comment handling - Update documentation with new test architecture details This resolves issues where pre-commit hooks (shfmt, end-of-file-fixer) were modifying test fixture files and breaking golden master tests. The new dynamic approach generates test data programmatically, making tests immune to formatting tools while maintaining comprehensive coverage.
56 lines
1.5 KiB
VimL
56 lines
1.5 KiB
VimL
" ShellSpec DSL plugin
|
|
" Neovim language support for ShellSpec testing framework
|
|
" Repository: https://github.com/ivuorinen/nvim-shellspec
|
|
" Author: Ismo Vuorinen
|
|
|
|
if exists('g:loaded_shellspec')
|
|
finish
|
|
endif
|
|
let g:loaded_shellspec = 1
|
|
|
|
" Detect Neovim and use appropriate implementation
|
|
if has('nvim-0.7')
|
|
" Use modern Neovim Lua implementation
|
|
" Initialize with error handling
|
|
lua << EOF
|
|
local ok, err = pcall(function()
|
|
-- Initialize configuration with defaults
|
|
require('shellspec.config').setup()
|
|
|
|
-- Setup autocommands and commands
|
|
require('shellspec.autocmds').setup()
|
|
|
|
-- Debug message
|
|
if vim.g.shellspec_debug then
|
|
vim.notify('ShellSpec Neovim: Loaded successfully', vim.log.levels.INFO)
|
|
end
|
|
end)
|
|
|
|
if not ok then
|
|
vim.notify('ShellSpec Neovim: Failed to load - ' .. tostring(err), vim.log.levels.ERROR)
|
|
end
|
|
EOF
|
|
|
|
else
|
|
" Fallback to VimScript implementation for older Vim
|
|
" Commands
|
|
command! ShellSpecFormat call shellspec#format_buffer()
|
|
command! -range ShellSpecFormatRange call shellspec#format_selection()
|
|
|
|
" Auto commands
|
|
augroup ShellSpec
|
|
autocmd!
|
|
autocmd FileType shellspec setlocal commentstring=#\ %s
|
|
autocmd FileType shellspec setlocal foldmethod=indent
|
|
autocmd FileType shellspec setlocal shiftwidth=2 tabstop=2 expandtab
|
|
augroup END
|
|
|
|
" Optional: Auto-format on save
|
|
if get(g:, 'shellspec_auto_format', 0)
|
|
augroup ShellSpecAutoFormat
|
|
autocmd!
|
|
autocmd BufWritePre *.spec.sh,*_spec.sh ShellSpecFormat
|
|
augroup END
|
|
endif
|
|
endif
|