aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/job_spec.lua
Commit message (Collapse)AuthorAge
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* fix(tests): use builtin default attributes in more placesbfredl2026-06-19
|
* test(windows): unskip some channel/job tests #38515Justin M. Keyes2026-06-12
|
* refactor(test): drop deprecated exc_exec #39242Justin M. Keyes2026-04-20
|
* feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987Ayaan2026-03-10
| | | | | | | | | | Problem: When a terminal process exits, "[Process Exited]" text is added to the buffer contents. Solution: - Return `exitcode` field from `nvim_get_chan_info`. - Show it in the default 'statusline'. - Show exitcode as virtual text in the terminal buffer.
* fix(tui): call tcdrain() on stdout and stderr on exit (#38154)zeertzjq2026-03-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: On FreeBSD, output written to TTY may be lost on exit. Example test failure: FAILED test/functional/terminal/tui_spec.lua @ 2521: TUI no assert failure on deadly signal #21896 test/functional/terminal/tui_spec.lua:2523: Row 1 did not match. Expected: |*Nvim: Caught deadly signal 'SIGTERM' | |* | |*[Process exited 1]^ | |* | |* | | | |{5:-- TERMINAL --} | Actual: |* | |*[Process exited 1]{100:^ }| |*{100:~ }| |*{100:~ }| |*{3:[No Name] }| | | |{5:-- TERMINAL --} | To print the expect() call that would assert the current screen state, use screen:snapshot_util(). In case of non-deterministic failures, use screen:redraw_debug() to show all intermediate screen states. Snapshot: screen:expect([[ | [Process exited 1]{100:^ }| {100:~ }|*2 {3:[No Name] }| | {5:-- TERMINAL --} | ]]) stack traceback: test/functional/ui/screen.lua:909: in function '_wait' test/functional/ui/screen.lua:537: in function 'expect' test/functional/terminal/tui_spec.lua:2523: in function <test/functional/terminal/tui_spec.lua:2521> Solution: Call tcdrain() on stdout and stderr on exit. This problem is only observed on FreeBSD, but it probably doesn't hurt to do this on all platforms with termios.h. In fact using tcdrain() on PTY slave is no-op on Linux according to Linux kernel source code.
* ci(test): bump Windows runners to windows-2025 and unskip tests (#37666)zeertzjq2026-02-03
| | | | Bumping to windows-2025 seems to fix at least one case of spaces having wrong attributes in TUI tests, which allow unskipping dozens of tests.
* fix(process): avoid unexpected behavior when PTY chdir failed (#37614)zeertzjq2026-01-29
| | | | | Problem: Unexpected behavior after PTY child process fails to chdir(), as it then thinks it's the parent process. Solution: Exit the child process instead of returning.
* fix(tui): log chdir failure properly #37591zeertzjq2026-01-28
|
* fix(process): avoid buffering unnecessary UI event with PTY CWD (#37582)zeertzjq2026-01-28
| | | | | | | | | | Problem: Calling os_chdir() to change the child processes' CWD may cause some unnecessary UI events to be buffered. These UI events don't go anywhere as execvp() is called before flushing the UI buffer. Solution: Use uv_chdir() instead of os_chdir(). Also fix getting error string incorrectly. Add test for the current behavior.
* test: fail CI if .nvimlog is not empty (#37470)zeertzjq2026-01-20
| | | | | | | | This will prevent adding passing tests which logs errors in .nvimlog. Close #28323 Related: https://github.com/neovim/neovim/pull/27660#issuecomment-2035738597 Co-authored-by: dundargoc <gocdundar@gmail.com>
* test: remove non-actionable tests from "pending" list #37384Justin M. Keyes2026-01-14
| | | | | | | | Problem: `t.skip()` adds to the "pending" list. If there is no path to fixing a pending test, it adds noise to the pending list. Solution: Return early instead of using `t.skip()`.
* fix(shell): ceci n'est pas une pipebfredl2026-01-13
| | | | | | | | | | | | | | | | | | On linux /dev/stdin is defined as a symlink to /proc/self/fd/0 This in turn is defined as a "magic" symlink which is allowed to point to internal kernel objects which really does not have a file name. As a glaring inconsistency, fopen("/proc/self/fd/0", "r") works if fd was originally opened using pipe() but not using socketpair(). As it happens UV_CREATE_PIPE does not create pipes but creates socket pairs. These two unfortunate conditions means that using /dev/stdin and similar does not work in shell commands in nvim on linux. as a work around, override libuv's descicion and create an actual pipe pair. This change is not needed on BSD:s but done unconditionally for simplicity, except for on windows where it is not done for stdout because of windows fixes #35984
* fix(channel): unreference list after callback finishes (#37358)zeertzjq2026-01-12
|
* fix(jobs): jobstart(term=true) accepts width/height #33904phanium2025-10-14
| | | | | | | Problem: when create a hidden terminal job with `nvim_buf_call`+ `jobstart(…,{term=true})`, program like `lazygit` cannot figure out the correct width and height. Solution: `jobstart(…,{term=true})` accepts `width`/`height`
* test(tui_spec): flakiness, global highlight definitions #34958luukvbaal2025-07-16
|
* docs: misc #32959Justin M. Keyes2025-03-18
|
* test: reduce flakiness in blocking wait tests (#32868)zeertzjq2025-03-13
|
* refactor(tests): drop os_kill #32401Justin M. Keyes2025-02-11
| | | Also change job tests to use `nvim` instead of random programs like `ping`.
* feat(ui): UI :detach commandJustin M. Keyes2025-02-10
| | | | | | | | | | | Problem: Cannot detach the current UI. Solution: - Introduce `:detach`. - Introduce `Channel.detach`. Co-authored-by: bfredl <bjorn.linse@gmail.com>
* fix(jobs): do not block UI when jobwait() doesn't block (#31803)Gregory Anders2025-01-01
|
* feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes2024-12-19
| | | | | | | | | | | | Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
* feat(terminal)!: cursor shape and blink (#31562)Gregory Anders2024-12-17
| | | | | | | | | | | | | | | | | | | | | When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
* refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes2024-09-15
| | | | | This module is generally used by any tests that need the full Nvim TUI instead of `screen.lua`. Thus it should live in `functional/` instead of in `functional/terminal/`.
* refactor(tests): more global highlight definitionsbfredl2024-05-26
|
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* test(core/job_spec): skip exit test if "sleep" command missing (#28137)zeertzjq2024-04-01
|
* test: use matches(...) instead of ok(string.find(...)) (#28111)zeertzjq2024-03-30
|
* refactor(tests): all screen tests should use highlightsbfredl2024-03-23
| | | | | | | | | | | | | | | | | | | | | | | This is the first installment of a multi-PR series significantly refactoring how highlights are being specified. The end goal is to have a base set of 20 ish most common highlights, and then specific files only need to add more groups to that as needed. As a complicating factor, we also want to migrate to the new default color scheme eventually. But by sharing a base set, that future PR will hopefully be a lot smaller since a lot of tests will be migrated just simply by updating the base set in place. As a first step, fix the anti-pattern than Screen defaults to ignoring highlights. Highlights are integral part of the screen state, not something "extra" which we only test "sometimes". For now, we still allow opt-out via the intentionally ugly screen._default_attr_ids = nil The end goal is to get rid of all of these eventually (which will be easier as part of the color scheme migration)
* fix(process): start pty process eof timer on main thread (#27625)zeertzjq2024-02-26
|
* refactor(tests): get channel id via nvim_get_chan_info #27441Justin M. Keyes2024-02-12
| | | Minor "best practices" nudge.
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: normalise nvim bridge functionsLewis Russell2024-01-12
| | | | | - remove helpers.cur*meths - remove helpers.nvim
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: remove helpers.sleep()Lewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test(core/job_spec): fix flakiness (#26623)zeertzjq2023-12-18
|
* fix(stream): do not close handle if it is already closing (#26537)Gregory Anders2023-12-12
| | | | | uv_close asserts that a handle is not already closing. We can guard against this assertion failure by manually checking the handle's closing status ourselves.
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
* test: use termopen() instead of :terminal more (#26462)zeertzjq2023-12-08
|
* fix(f_wait): flush UI before blocking (#25962)zeertzjq2023-11-10
|
* fix(job-control): make jobwait() flush UI after hiding cursor (#25927)zeertzjq2023-11-08
|
* test: unskip working Windows tests (#22537)dundargoc2023-03-13
| | | | Some tests that were previously not working have started to work again for unspecified reasons, so let's enable them.
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* revert: "jobstart(): Fix hang on non-executable cwd #9204" (#19826)zeertzjq2022-08-18
| | | | | This reverts commit c4c74c3883aa3122c0c877ca8dd7b26beb5cc4aa. LibUV already gives an error for this, so this isn't needed.