Skip to content

Commit

Permalink
ci: add busted test infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jun 11, 2024
1 parent ad1965a commit a6d9d9d
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
return {
_all = {
coverage = false,
lpath = "lua/?.lua;lua/?/init.lua",
lua = "~/.luarocks/bin/nlua",
},
default = {
verbose = true
},
tests = {
verbose = true
},
}
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Run tests
on:
pull_request: ~
push:
branches:
- main

jobs:
build:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
neovim_version: ['nightly', 'stable']

steps:
- uses: actions/checkout@v4
- name: Run tests
uses: nvim-neorocks/nvim-busted-action@v1
with:
nvim_version: ${{ matrix.neovim_version }}
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Running tests locally

You can run tests locally,
if you have [`luarocks`](https://luarocks.org/) or `busted` installed[^1].

[^1]: The test suite assumes that `nlua` has been installed
using luarocks into `~/.luarocks/bin/`.

You can then run:

```bash
luarocks test --local
# or
busted
```

Or if you want to run a single test file:

```bash
luarocks test spec/mytest_spec.lua --local
# or
busted spec/mytest_spec.lua
```

If you see a `module 'busted.runner'` not found error you need to update your `LUA_PATH`:

```bash
eval $(luarocks path --no-bin)
busted --lua nlua spec/mytest_spec.lua
```
20 changes: 20 additions & 0 deletions neocomplete.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rockspec_format = '3.0'
package = "neocomplete.nvim"
version = "scm-1"
source = {
url = "git+https://github.com/max397574/neocomplete.nvim"
}
dependencies = {
"fzy",
}
test_dependencies = {
"nlua",
"fzy",
}
build = {
type = "builtin",
copy_directories = {
"docs",
"plugin",
},
}
5 changes: 5 additions & 0 deletions spec/example_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('TODO: Add actual tests', function()
it('Test can access vim namespace', function()
assert.are.same(vim.trim(' a '), 'a')
end)
end)

0 comments on commit a6d9d9d

Please sign in to comment.