Comments (5)
You'll have to create a custom consumer. I've just added some small docs neotest.consumers
but the best examples will be the existing consumers. It'll also require using the plenary async library.
from neotest.
Use :h neotest.run.attach()
to see the output of the process as it runs
from neotest.
I see! If I want to dispatch to either neotest.run.attach
or neotest.summary.open
depending the status of a test case (whether it's running or status), I'll need to have a programmatic API. How to get the (current) test object on the cursor or access its status (or other fields) programatically?
from neotest.
Closing this as the plugin allows for the desired behaviour
from neotest.
I still think this is worth adding as a built-in component because it would be universally useful (either show the progress if in progress, or open the result if completed).
Anyway, the below is how I ended up adding my own custom consumers, following the suggestion:
neotest.setup {
...
-- Add custom consumers on your own
consumers = {
attach_or_output = M.custom_consumers.attach_or_output(),
},
}
function M.custom_consumers.attach_or_output()
local self = { name = "attach_or_output" }
local neotest = require("neotest")
---@type neotest.Client
local client = nil
self = setmetatable(self, {
__call = function(_, client_)
client = client_
return self
end,
})
-- neotest.attach_or_run.open()
function self.open(args)
args = args or {}
local pos = neotest.run.get_tree_from_args(args)
if pos and client:is_running(pos:data().id) then
neotest.run.attach()
else
neotest.output.open()
end
end
return self
end
Usage example:
command! -nargs=0 NeotestOutput lua require("neotest").attach_or_output.open()
from neotest.
Related Issues (20)
- [BUG] Watcher fails to find the lsp client after update to latest neotest with nio HOT 4
- [BUG] language name error when running any type of python test HOT 1
- [BUG] Cannot run nearest test or all tests from file HOT 6
- [BUG] Doing `gF` inside `neotest-output` floating window opens the file in same float
- [BUG] nested_tests causes test output from stdout/stderr to be printed undesirably
- [BUG] Files containing no tests shouldn't show up in summary
- [BUG] subprocess fails on non-default environments HOT 1
- Passing additional test arguments to runner HOT 1
- Feature Request: Set Notification Levels
- [BUG] Getting error "Future already set" and output_panel is empty for python tests HOT 7
- [Feature Request] Boost.Test supporting HOT 2
- Deprecation warnings on neovim 0.11
- [BUG] Summary opens, but no help HOT 2
- Graciously handling DAP failure on multistep (build then run) languages HOT 1
- [doc] Replace README recommendation of neodev with lazydev
- New Adapter: neotest-ctest - A neotest adapter for C/C++ using CTest as a test runner HOT 1
- [BUG] ImportError while importing test module HOT 3
- [BUG] "No tests found" when opening the summary window rigth before running tests the first time
- [BUG] Java file watcher does not work as the jdtls is marked as an invalid lsp HOT 1
- Lazy load adapters HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neotest.