node-client icon indicating copy to clipboard operation
node-client copied to clipboard

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

Open saidelike opened this issue 2 weeks ago • 4 comments

TLDR

There seems to be lots of testing frameworks for vim scripts:

  • https://github.com/cdelledonne/vim-utest
  • https://github.com/dhruvasagar/vim-testify
  • https://github.com/LucHermitte/vim-UT
  • https://github.com/junegunn/vader.vim
  • https://github.com/google/vroom
  • https://github.com/kana/vim-vspec
  • https://github.com/thinca/vim-themis
  • ...

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)

saidelike avatar May 15 '24 08:05 saidelike