From 14e8af7c30d36c131e975be55604dbd98a8900de Mon Sep 17 00:00:00 2001 From: Vhyrro Date: Mon, 20 May 2024 20:12:55 +0200 Subject: [PATCH] ci: initial attempt at busted tests --- .busted | 14 ++++++++++++++ .github/workflows/luarocks.yml | 3 ++- lua/neorg/core/modules.lua | 1 + .../core/integrations/treesitter/module.lua | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .busted diff --git a/.busted b/.busted new file mode 100644 index 000000000..2593bf533 --- /dev/null +++ b/.busted @@ -0,0 +1,14 @@ +return { + _all = { + coverage = false, + lpath = "lua/?.lua;lua/?/init.lua", + pattern = "module%.lua$", + auto_insulate = false, + }, + default = { + verbose = true, + }, + tests = { + verbose = true, + }, +} diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index 0250af49c..80bb9c287 100644 --- a/.github/workflows/luarocks.yml +++ b/.github/workflows/luarocks.yml @@ -24,7 +24,8 @@ jobs: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} with: version: ${{ env.LUAROCKS_VERSION }} - test_interpreters: null + test_interpreters: | + neovim-stable dependencies: | nvim-nio ~> 1.7 lua-utils.nvim == 1.0.2 diff --git a/lua/neorg/core/modules.lua b/lua/neorg/core/modules.lua index 15cfa68ee..182966617 100644 --- a/lua/neorg/core/modules.lua +++ b/lua/neorg/core/modules.lua @@ -45,6 +45,7 @@ local utils = require("neorg.core.utils") --- @field setup? fun(): neorg.module.setup? Function that is invoked before any other loading occurs. Should perform preliminary startup tasks. --- @field replaced? boolean If `true`, this means the module is a replacement for a core module. This flag is set automatically whenever `setup().replaces` is set to a value. --- @field on_event fun(event: neorg.event) A callback that is invoked any time an event the module has subscribed to has fired. +--- @field tests function A function for running tests. local modules = {} diff --git a/lua/neorg/modules/core/integrations/treesitter/module.lua b/lua/neorg/modules/core/integrations/treesitter/module.lua index 6964ec808..cef9ed2dc 100644 --- a/lua/neorg/modules/core/integrations/treesitter/module.lua +++ b/lua/neorg/modules/core/integrations/treesitter/module.lua @@ -911,4 +911,12 @@ module.events.subscribed = { }, } +module.tests = function() + describe("initial test to see if CI works (cannot be tested on a branch, must be tested on main, `act` doesn't work here, help)", function() + it("should be working", function() + assert.truthy("Yessir.") + end) + end) +end + return module