From 8934a7f6a389d77b39672b183acd8d3a61ab4023 Mon Sep 17 00:00:00 2001 From: Thomas Bell Date: Mon, 25 Aug 2025 12:22:05 -0600 Subject: [PATCH 1/2] added busted.lua --- .busted | 1 + tests/bootstrap-busted.sh | 2 ++ tests/busted.lua | 14 ++++++++++++++ 3 files changed, 17 insertions(+) create mode 100755 tests/bootstrap-busted.sh create mode 100644 tests/busted.lua diff --git a/.busted b/.busted index 98b3032..7ac5ad6 100644 --- a/.busted +++ b/.busted @@ -1,5 +1,6 @@ return { _all = { + lua = "./tests/bootstrap-busted.sh", coverage = false, }, default = { diff --git a/tests/bootstrap-busted.sh b/tests/bootstrap-busted.sh new file mode 100755 index 0000000..a55cced --- /dev/null +++ b/tests/bootstrap-busted.sh @@ -0,0 +1,2 @@ +#!/bin/sh +nvim -l ./tests/busted.lua $@ diff --git a/tests/busted.lua b/tests/busted.lua new file mode 100644 index 0000000..a198c89 --- /dev/null +++ b/tests/busted.lua @@ -0,0 +1,14 @@ +#!/usr/bin/env -S nvim -l + +vim.env.LAZY_STDPATH = ".tests" +load(vim.fn.system("cat $(pwd)/bootstrap.lua"))() +-- +-- -- Setup lazy.nvim +require("lazy.minit").busted({ + spec = { + "LazyVim/starter", + "williamboman/mason-lspconfig.nvim", + "williamboman/mason.nvim", + "nvim-treesitter/nvim-treesitter", + }, +}) From 6678b8a4c56e0fa9e2cbc5cd7135d08c7c1d724c Mon Sep 17 00:00:00 2001 From: Thomas Bell Date: Mon, 25 Aug 2025 12:28:26 -0600 Subject: [PATCH 2/2] updated the lazy vim documentation for busted tests --- doc/lazy.nvim.txt | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/doc/lazy.nvim.txt b/doc/lazy.nvim.txt index 2ae3b36..e78db3f 100644 --- a/doc/lazy.nvim.txt +++ b/doc/lazy.nvim.txt @@ -1363,31 +1363,14 @@ TESTING WITH BUSTED ~ This will add `"lunarmodules/busted"`, configure `hererocks` and run `busted`. -Below is an example of how I use **minit** to run tests with busted - in **LazyVim**. +Running tests with busted will leverge the [tests/busted.lua](https://github.com/folke/lazy.nvim/blob/add-busted-lua/tests/busted.lua) file, to setup the test environment using [lazy.minit](https://github.com/folke/lazy.nvim/blob/main/lua/lazy/minit.lua). ->lua - #!/usr/bin/env -S nvim -l - - vim.env.LAZY_STDPATH = ".tests" - load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))() - - -- Setup lazy.nvim - require("lazy.minit").busted({ - spec = { - "LazyVim/starter", - "williamboman/mason-lspconfig.nvim", - "williamboman/mason.nvim", - "nvim-treesitter/nvim-treesitter", - }, - }) -< +To run the tests with busted, simply run the following command from the root +of the repository: -To use this, you can run: - ->sh - nvim -l ./tests/busted.lua tests -< +```sh +busted tests +``` If you want to inspect the test environment, run: