vim-ultest: E5108: Error executing lua ...es/neovim/.config/nvim/plugged/vim-ultest/lua/ultest.lua:60: attempt to index local 'test' (a userdata value)

Describe the bug

While trying to run a TypeScript (filetype typescript) test with UltestDebugNearest, I run into this:

E5108: Error executing lua ...es/neovim/.config/nvim/plugged/vim-ultest/lua/ultest.lua:60: attempt to index local 'test' (a userdata value)

The vim-ultest.log file contains this:

10:02:19 | INFO | MainThread | logging.py:create_logger:74 | Logger created
10:02:19 | DEBUG | MainThread | __init__.py:__init__:40 | Handler created

Additional context

nvim --version

NVIM v0.5.0-dev+1231-g48e805728
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/nvim/parts/nvim/build/build/config -I/build/nvim/parts/nvim/build/src -I/build/nvim/parts/nvim/build/.deps/usr/include -I/usr/include -I/build/nvim/parts/nvim/build/build/src/nvim/auto -I/build/nvim/parts/nvim/build/build/include
Compiled by root@lgw01-amd64-055

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

python --version

Python 3.8.6

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 25 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@rcarriga Sorry for the noise on this one. Turns out I needed to run :UpdateRemotePlugins, and then everything started working

So there was a number of issues that you raised so I’ll address separately.

  1. The test#filename_modifier variable will now be respected
  2. Tests will now run with g:test#project_root as the current working directory if it exists
  3. I’ve added g:ultest_pre_run which should be a function name, which will be called before any test is run with Ultest, UltestNearest, UltestDebugNearest and the corresponding <Plug> mappings

As I said before, you will have to manually configure nvim-dap to respect the project root.

Also the reason vim-test doesn’t detect your file as a test is because it can’t tell if your runner is installed. Simply explicitly state what your runner is so for example with javascript/typescript and jest

let g:test#javascript_runner = "jest"

Please let me know if anything isn’t working as expected!