Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Neotest: Expose doctests in `:Neotest summary` window

### Fixed

- Testables: Run doctests when cargo-nextest is present
Expand Down
22 changes: 10 additions & 12 deletions lua/rustaceanvim/neotest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,16 @@ NeotestAdapter.discover_positions = function(file_path)
end
sort_positions(sorted_positions)

if #namespaces > 0 then
local file_pos = {
id = file_path,
name = vim.fn.fnamemodify(file_path, ':t'),
type = 'file',
path = file_path,
range = { 0, 0, max_end_row, 0 },
-- use the shortest namespace for the file runnable
runnable = namespaces[#namespaces].runnable,
}
table.insert(sorted_positions, 1, file_pos)
end
local file_pos = {
id = file_path,
name = vim.fn.fnamemodify(file_path, ':t'),
type = 'file',
path = file_path,
range = { 0, 0, max_end_row, 0 },
-- use the shortest namespace for the file runnable
runnable = #namespaces > 0 and namespaces[#namespaces].runnable or nil,
}
table.insert(sorted_positions, 1, file_pos)

return require('neotest.types.tree').from_list(sorted_positions, function(x)
return x.name
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/neotest/trans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function M.runnable_to_position(file_path, runnable)
type = 'dir'
elseif vim.startswith(runnable.label, 'test-mod') then
type = 'namespace'
elseif vim.startswith(runnable.label, 'test') then
elseif vim.startswith(runnable.label, 'test') or vim.startswith(runnable.label, 'doctest') then
type = 'test'
else
return
Expand Down