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 let
# The test case can either be the actual definition, # The test case can either be the actual definition,
# or a child attr named `module`. # or a child attr named `module`.
prepareModule = prepareModule = case: if lib.isFunction case then case else case.module or case;
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; };
mkTest = mkTest =
{ name, case }: { name, case }:
@ -60,12 +51,7 @@ lib.pipe (testFiles ++ [ exampleFiles ]) [
inherit name; inherit name;
path = mkTestDerivationFromNixvimModule { path = mkTestDerivationFromNixvimModule {
inherit name; inherit name;
module = { module = prepareModule case;
imports = [
(dontRunModule case)
(prepareModule case)
];
};
pkgs = pkgsUnfree; pkgs = pkgsUnfree;
}; };
}; };

View file

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

View file

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

View file

@ -1,14 +1,14 @@
{ {
empty = { empty = {
# For some reason, nvim hangs when using codeium-vim. After checking, it doesn't look like a bug though. # 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; plugins.codeium-vim.enable = true;
}; };
example = { example = {
# For some reason, nvim hangs when using codeium-vim. After checking, it doesn't look like a bug though. # 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 = { plugins.codeium-vim = {
enable = true; enable = true;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
# neorg should be re-packaged in nixpkgs from the luarocks `neorg` package. # neorg should be re-packaged in nixpkgs from the luarocks `neorg` package.
# In the meantime, disable the test. # In the meantime, disable the test.
# TODO: re-enable when this will have been fixed upstream. # TODO: re-enable when this will have been fixed upstream.
tests.dontRun = true; test.runNvim = false;
plugins.neorg.enable = true; plugins.neorg.enable = true;
}; };
@ -12,7 +12,7 @@
# neorg should be re-packaged in nixpkgs from the luarocks `neorg` package. # neorg should be re-packaged in nixpkgs from the luarocks `neorg` package.
# In the meantime, disable the test. # In the meantime, disable the test.
# TODO: re-enable when this will have been fixed upstream. # TODO: re-enable when this will have been fixed upstream.
tests.dontRun = true; test.runNvim = false;
plugins = { plugins = {
# Treesitter is required when using the "core.defaults" module. # 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 # As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
# the vim plugin. # the vim plugin.
# TODO: re-enable this test when this issue will have been fixed # TODO: re-enable this test when this issue will have been fixed
tests.dontRun = true; test.runNvim = false;
plugins.rest.enable = true; 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 # As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
# the vim plugin. # the vim plugin.
# TODO: re-enable this test when this issue will have been fixed # TODO: re-enable this test when this issue will have been fixed
tests.dontRun = true; test.runNvim = false;
plugins.rest = { plugins.rest = {
enable = true; enable = true;