Comments (3)
OK I've gotten around to this. Instead of allowing for another capture type, I've gone with a more blind approach of allowing a build_position
option to be given to the parse function. You can see the default for usage but it can return either a position or a list of positions so you can return sub-tests.
This approach should allow using treesitter captures to do some of the heavy lifting when parsing arguments.
from neotest.
The issue of parameterised tests has been raised by several adapters (#64 for example). I see a few ways to approach them
- As described, try parsing the parameters and figuring out the parameters that way. This is probably the simplest method but also quite unreliable as it relies on parameters being in a form that is parseable.
- Using a different parsing method such as LSP to basically do the same as 1 but (maybe) more reliably. This introduces the complexity of interacting with LSPs.
- The adapter hooks into the test runner to get the tests. This is the most reliable method since it doesn't do any guessing, but it requires more from an adapter implementation. neotest-python for instance does hook into the runner for results and would be able to for discovery too, I just haven't implemented that. Jest in particular should be possible as they have https://github.com/jest-community/jest-editor-support/.
- Returning a new tree from the results. This would allow runners to return newly discovered tests with results but I'm not sure how neotest core would manage regularly parsed tests and results discovered tests (e.g. when a file is written currently the entire tree is rebuilt, but that would lose the tests discovered from the results)
Option 3 is and always will be the best route to go, and I explicitly designed the interfaces with that route in mind, both neotest-python and neotest-plenary hook into the runner. I can add in a hook to generate tests from the args as you suggest though.
from neotest.
Going to close this as I don't believe neotest core can do much more, the rest will be down to adapters. Going with my fourth option above would be a large endeavour for a relatively minor feature, especially when there are better solutions
from neotest.
Related Issues (20)
- [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
- [Question] Subprocess with `--clean` flag
- [Feature Request] Enable setting custom environment variables for summary runs HOT 2
- [Feature] option to hide the adapter name
- [Documentation] RunSpec stream clarification HOT 2
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.