tests: tests.dontRun -> test.runNvim

Convert all test-cases to use the new `test.runNvim` module option.
This commit is contained in:
Matt Sturgeon 2024-08-20 00:44:25 +01:00
parent f47374fd26
commit 7b2a6cd9e6
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
13 changed files with 31 additions and 45 deletions

View file

@ -43,16 +43,7 @@ lib.pipe (testFiles ++ [ exampleFiles ]) [
let
# The test case can either be the actual definition,
# or a child attr named `module`.
prepareModule =
case: if lib.isFunction case then case else case.module or (lib.removeAttrs case [ "tests" ]);
# Convert legacy `dontRun` definitions into `test.runNvim` option defs
dontRunModule =
case:
let
dontRun = case.tests.dontRun or false;
in
lib.optionalAttrs dontRun { test.runNvim = false; };
prepareModule = case: if lib.isFunction case then case else case.module or case;
mkTest =
{ name, case }:
@ -60,12 +51,7 @@ lib.pipe (testFiles ++ [ exampleFiles ]) [
inherit name;
path = mkTestDerivationFromNixvimModule {
inherit name;
module = {
imports = [
(dontRunModule case)
(prepareModule case)
];
};
module = prepareModule case;
pkgs = pkgsUnfree;
};
};

View file

@ -1,12 +1,12 @@
# We cannot run the test as loading the plugin requires a valid OPENAI_API_KEY
{
empty = {
tests.dontRun = true;
test.runNvim = false;
plugins.chatgpt.enable = true;
};
defaults = {
tests.dontRun = true;
test.runNvim = false;
plugins.chatgpt = {
enable = true;
@ -198,7 +198,7 @@
};
example = {
tests.dontRun = true;
test.runNvim = false;
plugins.chatgpt = {
enable = true;

View file

@ -1,7 +1,7 @@
{
empty = {
# We do not provide the required HF_API_KEY environment variable.
tests.dontRun = true;
test.runNvim = false;
plugins.cmp = {
enable = true;
@ -11,7 +11,7 @@
example = {
# We do not provide the required HF_API_KEY environment variable.
tests.dontRun = true;
test.runNvim = false;
plugins = {
cmp = {

View file

@ -1,14 +1,14 @@
{
empty = {
# For some reason, nvim hangs when using codeium-vim. After checking, it doesn't look like a bug though.
tests.dontRun = true;
test.runNvim = false;
plugins.codeium-vim.enable = true;
};
example = {
# For some reason, nvim hangs when using codeium-vim. After checking, it doesn't look like a bug though.
tests.dontRun = true;
test.runNvim = false;
plugins.codeium-vim = {
enable = true;

View file

@ -1,14 +1,14 @@
{
empty = {
# This test is flaky and fails non-deterministically
tests.dontRun = true;
test.runNvim = false;
plugins.octo.enable = true;
};
example = {
# This test is flaky and fails non-deterministically
tests.dontRun = true;
test.runNvim = false;
plugins.octo = {
enable = true;
@ -28,7 +28,7 @@
withFzfLuaPicker = {
# This test is flaky and fails non-deterministically
tests.dontRun = true;
test.runNvim = false;
plugins.octo = {
enable = true;
@ -38,7 +38,7 @@
defaults = {
# This test is flaky and fails non-deterministically
tests.dontRun = true;
test.runNvim = false;
plugins.octo = {
enable = true;

View file

@ -83,7 +83,7 @@
no-nix = {
# TODO: See if we can build parsers (legacy way)
tests.dontRun = true;
test.runNvim = false;
plugins.treesitter = {
enable = true;
nixGrammars = false;

View file

@ -2,7 +2,7 @@
example = {
# We cannot test neotest-gtest as it tries to create file in the upper directory
# https://github.com/alfaix/neotest-gtest/blob/6e794ac91f4c347e2ea5ddeb23d594f8fc64f2a8/lua/neotest-gtest/utils.lua#L10-L16
tests.dontRun = true;
test.runNvim = false;
plugins = {
treesitter.enable = true;

View file

@ -1,7 +1,7 @@
{
empty = {
# A warning is displayed on stdout
tests.dontRun = true;
test.runNvim = false;
plugins.telescope = {
enable = true;
@ -11,7 +11,7 @@
defaults = {
# A warning is displayed on stdout
tests.dontRun = true;
test.runNvim = false;
plugins.telescope = {
enable = true;
@ -46,7 +46,7 @@
example = {
# A warning is displayed on stdout
tests.dontRun = true;
test.runNvim = false;
plugins.telescope = {
enable = true;

View file

@ -2,7 +2,7 @@
empty = {
# At runtime, the plugin tries to get the size of the terminal which doesn't exist in the
# headless environment.
tests.dontRun = true;
test.runNvim = false;
plugins.image.enable = true;
};
@ -10,7 +10,7 @@
defaults = {
# At runtime, the plugin tries to get the size of the terminal which doesn't exist in the
# headless environment.
tests.dontRun = true;
test.runNvim = false;
plugins.image = {
enable = true;
@ -67,7 +67,7 @@
ueberzug-backend = {
# At runtime, the plugin tries to get the size of the terminal which doesn't exist in the
# headless environment.
tests.dontRun = true;
test.runNvim = false;
plugins.image = {
enable = true;

View file

@ -2,7 +2,7 @@
empty = {
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
# test environment
tests.dontRun = true;
test.runNvim = false;
plugins.harpoon.enable = true;
};
@ -10,7 +10,7 @@
telescopeEnabled = {
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
# test environment
tests.dontRun = true;
test.runNvim = false;
plugins.telescope = {
enable = true;
@ -75,7 +75,7 @@
telescopeDisabled = {
# Harpoon expects to access `~/.local/share/nvim/harpoon.json` which is not available in the
# test environment
tests.dontRun = true;
test.runNvim = false;
plugins.harpoon = {
enable = true;

View file

@ -1,13 +1,13 @@
{
empty = {
# don't run tests as they try to access the network.
tests.dontRun = true;
test.runNvim = false;
plugins.neocord.enable = true;
};
defaults = {
# don't run tests as they try to access the network.
tests.dontRun = true;
test.runNvim = false;
plugins.neocord = {
enable = true;
@ -39,7 +39,7 @@
example = {
# don't run tests as they try to access the network.
tests.dontRun = true;
test.runNvim = false;
plugins.neocord = {
enable = true;

View file

@ -3,7 +3,7 @@
# neorg should be re-packaged in nixpkgs from the luarocks `neorg` package.
# In the meantime, disable the test.
# TODO: re-enable when this will have been fixed upstream.
tests.dontRun = true;
test.runNvim = false;
plugins.neorg.enable = true;
};
@ -12,7 +12,7 @@
# neorg should be re-packaged in nixpkgs from the luarocks `neorg` package.
# In the meantime, disable the test.
# TODO: re-enable when this will have been fixed upstream.
tests.dontRun = true;
test.runNvim = false;
plugins = {
# Treesitter is required when using the "core.defaults" module.

View file

@ -3,7 +3,7 @@
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
# the vim plugin.
# TODO: re-enable this test when this issue will have been fixed
tests.dontRun = true;
test.runNvim = false;
plugins.rest.enable = true;
};
@ -12,7 +12,7 @@
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
# the vim plugin.
# TODO: re-enable this test when this issue will have been fixed
tests.dontRun = true;
test.runNvim = false;
plugins.rest = {
enable = true;