rcarriga / vim-ultest

The ultimate testing plugin for (Neo)Vim
MIT License
385 stars 15 forks source link

Go: a failing test appears to put nvim into insert mode at the end #47

Closed RonanMacF closed 3 years ago

RonanMacF commented 3 years ago

Describe the bug Running Ultest-nearest on a passing test works as expected. Running Ultest-nearest on a failing test puts neovim into insert mode at the end. Running Ultest-file which contains a failing test also puts neovim into insert mode.

asciicinema

11:27:09 | INFO | MainThread | logging.py:create_logger:98 | Logger created
11:27:09 | DEBUG | MainThread | __init__.py:__init__:43 | Handler created
11:27:09 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:58 | Starting job with group update_positions
11:27:09 | INFO | Thread-1 | tracker.py:_async_update:55 | Updating positions in dap_test.go
11:27:09 | DEBUG | Thread-1 | file.py:parse_file_structure:25 | Converted pattern {'test': ['\\v^\\s*func (\\w+)'], 'namespace': []} to {'test': [re.compile('^\\s*func (\\w+)')], 'namespace': []}
11:27:09 | DEBUG | Thread-1 | tracker.py:_async_update:82 | New test dap_test.go found in dap_test.go
11:27:09 | DEBUG | Thread-1 | tracker.py:_async_update:82 | New test TestSuccess-3646284460309850492 found in dap_test.go
11:27:09 | DEBUG | Thread-1 | tracker.py:_async_update:82 | New test TestFailure-3646284460309850492 found in dap_test.go
11:27:09 | DEBUG | Thread-1 | tracker.py:_remove_old_positions:125 | No tests removed
11:27:09 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:78 | Finished job with group update_positions
11:27:21 | INFO | MainThread | __init__.py:run_nearest:125 | Running nearest test in dap_test.go at line 9
11:27:21 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering TestSuccess-3646284460309850492 as started
11:27:21 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:58 | Starting job with group TestSuccess-3646284460309850492
11:27:21 | DEBUG | Thread-1 | processes.py:run:50 | Starting test process TestSuccess-3646284460309850492 with command ['go', 'test', '-run', 'TestSuccess$', './.'], cwd = None, env = None
11:27:21 | DEBUG | Thread-1 | processes.py:run:76 | Process TestSuccess-3646284460309850492 complete with exit code: 0
11:27:21 | DEBUG | Thread-1 | __init__.py:_register_result:292 | Registering TestSuccess-3646284460309850492 as exited with result {"id": "TestSuccess-3646284460309850492", "file": "dap_test.go", "code": 0, "output": "/var/folders/x4/wv98pc6d38n0ykn769h63jjw0000gn/T/ultestznheystd/dap_test_go/TestSuccess-3646284460309850492_out"}
11:27:21 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:78 | Finished job with group TestSuccess-3646284460309850492
11:27:25 | INFO | MainThread | __init__.py:run_nearest:125 | Running nearest test in dap_test.go at line 14
11:27:25 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering TestFailure-3646284460309850492 as started
11:27:25 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:58 | Starting job with group TestFailure-3646284460309850492
11:27:25 | DEBUG | Thread-1 | processes.py:run:50 | Starting test process TestFailure-3646284460309850492 with command ['go', 'test', '-run', 'TestFailure$', './.'], cwd = None, env = None
11:27:26 | DEBUG | Thread-1 | processes.py:run:76 | Process TestFailure-3646284460309850492 complete with exit code: 1
11:27:26 | DEBUG | Thread-1 | __init__.py:_register_result:292 | Registering TestFailure-3646284460309850492 as exited with result {"id": "TestFailure-3646284460309850492", "file": "dap_test.go", "code": 1, "output": "/var/folders/x4/wv98pc6d38n0ykn769h63jjw0000gn/T/ultestznheystd/dap_test_go/TestFailure-3646284460309850492_out"}
11:27:26 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:78 | Finished job with group TestFailure-3646284460309850492
11:27:26 | DEBUG | MainThread | __init__.py:_present_output:109 | Showing TestFailure-3646284460309850492 output
11:27:31 | INFO | MainThread | __init__.py:run_nearest:125 | Running nearest test in dap_test.go at line 0
11:27:31 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering dap_test.go as started
11:27:31 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering TestSuccess-3646284460309850492 as started
11:27:31 | DEBUG | MainThread | __init__.py:_register_started:281 | Registering TestFailure-3646284460309850492 as started
11:27:31 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:58 | Starting job with group dap_test.go
11:27:31 | DEBUG | Thread-1 | processes.py:run:50 | Starting test process dap_test.go with command ['go', 'test'], cwd = None, env = None
11:27:31 | DEBUG | Thread-1 | processes.py:run:76 | Process dap_test.go complete with exit code: 1
11:27:31 | DEBUG | Thread-1 | __init__.py:_register_result:292 | Registering dap_test.go as exited with result {"id": "dap_test.go", "file": "dap_test.go", "code": 1, "output": "/var/folders/x4/wv98pc6d38n0ykn769h63jjw0000gn/T/ultestznheystd/dap_test_go/dap_test_go_out"}
11:27:31 | DEBUG | Thread-1 | __init__.py:_register_result:292 | Registering TestSuccess-3646284460309850492 as exited with result {"id": "TestSuccess-3646284460309850492", "file": "dap_test.go", "code": 1, "output": "/var/folders/x4/wv98pc6d38n0ykn769h63jjw0000gn/T/ultestznheystd/dap_test_go/dap_test_go_out"}
11:27:31 | DEBUG | Thread-1 | __init__.py:_register_result:292 | Registering TestFailure-3646284460309850492 as exited with result {"id": "TestFailure-3646284460309850492", "file": "dap_test.go", "code": 1, "output": "/var/folders/x4/wv98pc6d38n0ykn769h63jjw0000gn/T/ultestznheystd/dap_test_go/dap_test_go_out"}
11:27:31 | DEBUG | Thread-1 | __init__.py:_handle_coroutine:78 | Finished job with group dap_test.go
11:27:31 | DEBUG | MainThread | __init__.py:_present_output:109 | Showing dap_test.go output
11:27:31 | DEBUG | MainThread | __init__.py:_present_output:109 | Showing TestSuccess-3646284460309850492 output
11:27:31 | DEBUG | MainThread | __init__.py:_present_output:109 | Showing TestFailure-3646284460309850492 output
rcarriga commented 3 years ago

Now that is a weird one 😅 Not sure how I can debug this. I'd imagine there is something else in your config, because I've never experienced this. If you can try and replicate with a minimal init.vim then I can narrow it down further

RonanMacF commented 3 years ago

looks like I may have jumped the gun. After some investigation I realised the problem is au TermOpen,TermEnter,BufEnter * if &buftype == 'terminal' | :startinsert | endif

I use this aucmd to automatically enter insert mode when I enter a terminal buffer, looks like Ulteset may be opening a terminal scratch buffer or something. Will close as user error