neovim / neovim/node-client

docs: recommended way to test a node plugin on GitHub CI?

Open
#360 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
TypeScript
Stars
537
Forks
57
Avg merge
1h 6m
Merged PRs (30d)
6

Description

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.

2024-05-14 21:16:47 INF     ✔ [[1,3],4,2]
2024-05-14 21:16:47 INF     ✔ [[0,2],1]
2024-05-14 21:16:47 INF     ✔ [[0,2],1,0]
2024-05-14 21:16:47 INF
2024-05-14 21:16:47 INF
2024-05-14 21:16:47 INF   4130 passing (19s)
2024-05-14 21:16:47 INF   2881 pending
2024-05-14 21:16:47 INF   1 failing
2024-05-14 21:16:47 INF
2024-05-14 21:16:47 INF   1) recorded test cases
       recorded/actions/copySecondToken:

      Unexpected final state
      + expected - actual

       {
      -  "clipboard": ""
      +  "clipboard": "value"
         "documentContents": "\nconst value = \"Hello world\";\n"
         "selections": [
           {
             "active": {

      at runTest (packages\test-harness\dist\cursorless-neovim-e2e\src\suite\recorded.neovim.test.cjs:28661:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the node-client packages/integration-tests example and the linked Cursorless entry points: packages/test-harness/src/index.ts, cursorless.nvim/lua/cursorless/init.lua, and the recorded test suite. Determine whether a Vim-based or node-client-based GitHub CI approach is recommended and how test results should be exposed; done means documenting a reproducible workflow and its output handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, nodejs, typescript, vim
Domain
ci-cd, documentation, testing-qa
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.