Skip to content

Commit

Permalink
test: add testing with nvim-test
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jan 30, 2024
1 parent 8016b06 commit 0c092bc
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 214 deletions.
61 changes: 38 additions & 23 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
---
name: CI

on:
pull_request: ~
push:
branches:
- master
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Run tests
commit_lint:
runs-on: ubuntu-latest
steps:
# Check commit messages
- uses: webiny/action-conventional-commits@v1.1.0

test:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
fail-fast: true
matrix:
neovim_branch: ["v0.8.1", "nightly"]
neovim_branch:
- 'v0.9.5'
- 'nightly'

env:
NVIM_TEST_VERSION: ${{ matrix.neovim_branch }}

steps:
# Checkout packer
- uses: actions/checkout@v2

# Prepare taken from telescope
- name: Prepare
run: |
mkdir -p _neovim
curl -sL https://github.com/neovim/neovim/releases/download/${{ matrix.neovim_branch }}/nvim-linux64.tar.gz | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
- name: Run tests
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
make test
- name: Checkout
uses: actions/checkout@v3

- uses: leafo/gh-actions-lua@v9
with:
luaVersion: "5.1.5"

- uses: leafo/gh-actions-luarocks@v4

- name: Download nvim-test
run: make nvim-test

- name: Run Test
run: make test
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

nvim-test:
git clone https://github.com/lewis6991/nvim-test
nvim-test/bin/nvim-test --init

.PHONY: test
test: nvim-test
nvim-test/bin/nvim-test test \
--lpath=$(PWD)/lua/?.lua \

50 changes: 50 additions & 0 deletions test/pluginspec_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
local helpers = require('nvim-test.helpers')
local exec_lua = helpers.exec_lua
local eq = helpers.eq

describe('plugin spec formats', function()
before_each(function()
helpers.clear()

-- Make pckr available
exec_lua('package.path = ...', package.path)
end)

it('can process a simple string spec', function()
eq({
['gitsigns.nvim'] = {
install_path = '/gitsigns.nvim',
installed = false,
name = 'gitsigns.nvim',
revs = { },
simple = true,
type = 'git',
url = 'https://github.com/lewis6991/gitsigns.nvim'
} }, exec_lua[[
return require('pckr.plugin').process_spec { 'lewis6991/gitsigns.nvim' }
]])
end)

it('can process a simple table spec', function()
exec_lua[[
require('pckr.plugin').process_spec {
}
]]
eq({
['gitsigns.nvim'] = {
install_path = '/gitsigns.nvim',
installed = false,
name = 'gitsigns.nvim',
revs = { },
simple = false,
tag = 'v0.7',
type = 'git',
url = 'https://github.com/lewis6991/gitsigns.nvim'
} }, exec_lua[[
return require('pckr.plugin').process_spec {
{ 'lewis6991/gitsigns.nvim', tag = "v0.7" }
}
]])
end)

end)
27 changes: 0 additions & 27 deletions tests/helpers.lua

This file was deleted.

32 changes: 0 additions & 32 deletions tests/local_plugin_spec.lua

This file was deleted.

3 changes: 0 additions & 3 deletions tests/minimal.vim

This file was deleted.

24 changes: 0 additions & 24 deletions tests/packer_plugin_utils_spec.lua

This file was deleted.

28 changes: 0 additions & 28 deletions tests/packer_use_spec.lua

This file was deleted.

77 changes: 0 additions & 77 deletions tests/plugin_utils_spec.lua

This file was deleted.

0 comments on commit 0c092bc

Please sign in to comment.