Skip to content

Nvim Busted Action

Actions
Test Neovim plugins with Busted
v1.1.0
Latest
Star (17)

Tags

 (1)

nvim-busted-action

A composite GitHub action for running busted tests with Neovim.

Supports stable releases, nightly releases and specifying versions.

Usage

Setup

To run tests with busted, you need

  • A rockspec, to specify test dependencies. It should have nlua in its test_dependencies list. See also: Rockspec format
  • A .busted file that tells busted how to run your tests with Neovim as the Lua interpreter.
  • A spec directory containing test files, their names ending in _spec.lua.

Example

---
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 }}

Running tests locally

With the above setup, you can run tests locally, if you have luarocks or busted installed1.

You can then run:

luarocks test --local
# or
busted

Or if you want to run a single test file:

luarocks test spec/path_to_file.lua --local
# or
busted spec/path_to_file.lua

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

eval $(luarocks path --no-bin --lua-version 5.1)
busted --lua nlua spec/mytest_spec.lua

Inputs

nvim_version (optional)

Version of Neovim to install. Valid values are stable, nightly or version tag such as v0.9.2.

  • Default: stable

Important

This value must exactly match to a tag name when installing the specific version.

luarocks_version (optional)

Version of LuaRocks2 to install.

  • Default: 3.11.1

before (optional)

A bash script to run before running the tests. For example, you can use this to install additional luarocks packages that can't be installed automatically using luarocks test.

Resources

Footnotes

  1. The test suite assumes that nlua has been installed using luarocks into ~/.luarocks/bin/.

  2. This action uses LuaRocks to install busted and test dependencies.

Nvim Busted Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Test Neovim plugins with Busted
v1.1.0
Latest

Tags

 (1)

Nvim Busted Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.