-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d60410b
commit 3bf88d1
Showing
6 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
local M = { | ||
'nvim-neotest/neotest', | ||
dependencies = { | ||
'nvim-neotest/nvim-nio', | ||
'nvim-lua/plenary.nvim', | ||
'antoinemadec/FixCursorHold.nvim', | ||
'nvim-treesitter/nvim-treesitter', | ||
'nvim-neotest/neotest-jest', | ||
}, | ||
|
||
config = function() | ||
require('neotest').setup { | ||
adapters = { | ||
require 'neotest-jest' { | ||
jestCommand = 'npm test --', | ||
jestConfigFile = function(file) | ||
if string.find(file, '/packages/') and string.match(file, '(.-/[^/]+/)src') then | ||
return string.match(file, '(.-/[^/]+/)src') .. 'jest.config.ts' | ||
end | ||
|
||
return vim.fn.getcwd() .. '/jest.config.ts' | ||
end, | ||
env = { CI = true }, | ||
cwd = function(file) | ||
if string.find(file, '/packages/') then | ||
return string.match(file, '(.-/[^/]+/)src') | ||
end | ||
return vim.fn.getcwd() | ||
end, | ||
}, | ||
}, | ||
} | ||
end, | ||
|
||
keys = { | ||
{ '<leader>t', '', desc = '+test' }, | ||
{ | ||
'<leader>tt', | ||
function() | ||
require('neotest').run.run(vim.fn.expand '%') | ||
end, | ||
desc = 'Run File', | ||
}, | ||
{ | ||
'<leader>tT', | ||
function() | ||
require('neotest').run.run(vim.uv.cwd()) | ||
end, | ||
desc = 'Run All Test Files', | ||
}, | ||
{ | ||
'<leader>tr', | ||
function() | ||
require('neotest').run.run() | ||
end, | ||
desc = 'Run Nearest', | ||
}, | ||
{ | ||
'<leader>tl', | ||
function() | ||
require('neotest').run.run_last() | ||
end, | ||
desc = 'Run Last', | ||
}, | ||
{ | ||
'<leader>ts', | ||
function() | ||
require('neotest').summary.toggle() | ||
end, | ||
desc = 'Toggle Summary', | ||
}, | ||
{ | ||
'<leader>to', | ||
function() | ||
require('neotest').output.open { enter = true, auto_close = true } | ||
end, | ||
desc = 'Show Output', | ||
}, | ||
{ | ||
'<leader>tO', | ||
function() | ||
require('neotest').output_panel.toggle() | ||
end, | ||
desc = 'Toggle Output Panel', | ||
}, | ||
{ | ||
'<leader>tS', | ||
function() | ||
require('neotest').run.stop() | ||
end, | ||
desc = 'Stop', | ||
}, | ||
{ | ||
'<leader>tw', | ||
function() | ||
require('neotest').watch.toggle(vim.fn.expand '%') | ||
end, | ||
desc = 'Toggle Watch', | ||
}, | ||
}, | ||
} | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters