-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: recommended way to test a node plugin on GitHub CI? #360
Comments
We should document this (probably in
If getting test results in a structured format like TAP or XML is important, I would use busted. Otherwise I wouldn't use a test framework. I would just write tests in a Lua script and use
That's assuming you are testing a plugin (Lua code that invokes RPC methods on your node-client module), so testing end-to-end is a good idea. But f your Lua plugin code is minimal, you could skip that part and write tests directly against your node module like any other node project.
The only purpose of that sub-package is to run a separate process to fully isolate the test runner from the node-client module being tested. But if you use the end-to-end approach described above, driven by Lua, then you don't need the
LGTM. Though |
@justinmk Thanks for all your insights, definitely helpful. I have a single exported node function Am I understanding it correctly that writing tests in lua with |
I think the issue with running the tests synchronously is that during the execution of the node test, we exercise code that calls from node back to lua, eg to modify editors / run neovim commands. I'm guessing that the lua execution context is single-threaded, so if it is hanging waiting for the tests to finish, it's not able to respond to the requests from the node process, so node just hangs, and we effectively have a deadlock. Does that make sense? |
Yes. If if it wasn't "single threaded", what would you expect the result to be? Doing roundtrips in a single request, between processes that are inspecting state of each process, can't have any reasonable behavior, in mutable systems. |
TLDR
There seems to be lots of testing frameworks for vim scripts:
Should I use one of them and just call my node exported test function from vim script? If so, how do I get the test results output?
Should I use a technique similar to what node-client is doing instead, see https://github.com/neovim/node-client/tree/master/packages/integration-tests ? If so, how do I get the test results output?
Any pointers or help is appreciated.
This is how I currently test my neovim node plugin locally
I've got a neovim node plugin that exposes a test framework entry point. This function ends up calling into mocha in order to run all the tests.
I am able to run the tests nicely from a local environment after neovim starts by calling the test framework entry point from the neovim config. And I can read the output from the log file that is written thanks to the
NVIM_NODE_LOG_FILE
environment variable.The text was updated successfully, but these errors were encountered: