aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/net_spec.lua
Commit message (Collapse)AuthorAge
* test(vim.net): replace httpbingo with a local serverLewis Russell2026-09-18
| | | | | | | | | | | Problem: Requests to httpbingo can outlast the helper's two-second wait and leave a nil result, causing CI failures. Solution: Serve the basic HTTP tests locally and check the received methods, headers and bodies. Wait for callbacks using the test harness and run these tests without NVIM_TEST_INTEG. AI-assisted
* refactor(zip)!: builtin zip.lua plugin #40846Barrett Ruth2026-07-29
| | | | | | | | | | Problem: The bundled `zip` plugin is implemented in Vimscript, making it harder to maintain and build on with Nvim's Lua runtime infrastructure. Solution: Add an opt-out `zip.lua` browser backed by `nvim.dir`, and disable the legacy Vimscript implementation by moving it to `pack/dist/opt/zip/`. Load it with `:packadd zip`.
* 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`.
* test: mark non-actionable tests as N/A #40207Justin M. Keyes2026-06-12
| | | | | | | | | | Problem: Listing individual "skipped" notices for each non-actionable or NVIM_TEST_INTEG test is noisy and makes the "skipped" list overwhelming and less meaningful. Solution: - Mark non-actionable tests with "N/A". - Report NVIM_TEST_INTEG tests as a separate 1-line summary.
* fix(vim.net): unreliable integration tests #39594Ellison2026-05-05
|
* feat(vim.net): request() accepts more http methods #39406Ellison2026-05-01
|
* refactor(test): drop deprecated exc_exec #39242Justin M. Keyes2026-04-20
|
* test: replace busted with local harnessLewis Russell2026-04-15
| | | | | | | | | | | | | | | | | | | Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex
* feat(vim.net): custom request() headers #38837Ellison2026-04-10
| | | | | | | Problem Cannot specify headers in vim.net.request() call. Solution Support opts.headers in vim.net.request opts.
* fix(net): handle remote archive URLs via tar/zip browse #38744Tom Ampuero2026-04-05
| | | | | | | | | Problem: Opening .tar.gz or .zip URLs shows raw binary instead of using the archive plugins. Solution: Similar to the original netrw implementation, the autocmd should detect archive URLs, download them to a temp file and the open them with tar/zip handlers already bundled as vim plugins.
* feat(net): vim.net.request(outbuf) writes response to buffer #36164Yochem van Rosmalen2026-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Non-trivial to write output of vim.net.request to buffer. Requires extra code in plugin/net.lua which can't be reused by other plugin authors. ``` vim.net.request('https://neovim.io', {}, function(err, res) if not err then local buf = vim.api.nvim_create_buf(true, false) if res then local lines = vim.split(res.body, '\n', { plain = true }) vim.api.nvim_buf_set_lines(buf, 0, -1, true, lines) end end end) ``` Solution: Accept an optional `outbuf` argument to indicate the buffer to write output to, similar to `outpath`. vim.net.request('https://neovim.io', { outbuf = buf }) Other fixes / followups: - Make plugin/net.lua smaller - Return objection with close() method - vim.net.request.Opts class - vim.validate single calls - Use (''):format(...) instead of `..`
* refactor: deduplicate testJustin M. Keyes2025-11-22
|
* fix(vim.net): filetype detection, mark unmodified #36297Michele Sorcinelli2025-11-19
| | | | | | | | | | | | | | | | | | Problem: When running ":edit <url>", filetype detection is not triggered. Solution: Run the autocmds in the filetypedetect group after loading the content. Problem: After fetching remote content from a URL and adding it to the buffer, the buffer is marked as modified. This is inconsistent with the original netrw behavior, and it causes problems with `:e` to refresh or `:q` as it prompts for saving the file even if the user hasn't touched the content at all. Solution: Mark the buffer as unmodified right after adding the remote content to the buffer.
* feat(net): vim.net.request(), :edit [url] #34140Tom Ampuero2025-07-13
Problem: Nvim depends on netrw to download/request URL contents. Solution: - Add `vim.net.request()` as a thin curl wrapper: - Basic GET with --silent, --show-error, --fail, --location, --retry - Optional `opts.outpath` to save to a file - Operates asynchronously. Pass an `on_response` handler to get the result. - Add integ tests (requires NVIM_TEST_INTEG to be set) to test success and 404 failure. - Health check for missing `curl`. - Handle `:edit https://…` using `vim.net.request()`. API Usage: 1. Asynchronous request: vim.net.request('https://httpbingo.org/get', { retry = 2 }, function(err, response) if err then print('Fetch failed:', err) else print('Got body of length:', #response.body) end end) 2. Download to file: vim.net.request('https://httpbingo.org/get', { outpath = 'out_async.txt' }, function(err) if err then print('Error:', err) end end) 3. Remote :edit integration (in runtime/plugin/net.lua) fetches into buffer: :edit https://httpbingo.org/get