aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-24 18:03:06 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-24 18:25:00 +0100
commit6c0646e1d6050338aa20c8eecb00c7e5f96b4afe (patch)
treeffe5f2c076602feb1545d19276ee09aa74419c3d
parenttests(infrastructure/driver): Support setting the golden file (diff)
downloadnixos-config-6c0646e1d6050338aa20c8eecb00c7e5f96b4afe.zip
tests(tests/nvim-checkhealth): Init
Diffstat (limited to '')
-rw-r--r--flake/default.nix3
-rw-r--r--tests/by-name/nv/nvim-checkhealth/test.desc22
-rw-r--r--tests/by-name/nv/nvim-checkhealth/test.nix44
-rw-r--r--tests/default.nix3
4 files changed, 72 insertions, 0 deletions
diff --git a/flake/default.nix b/flake/default.nix
index 222b18ac..ded656e7 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -66,6 +66,9 @@
extraModules = {
termfilechooser = "${nixpkgs_open_prs.nixpkgs-tfc}/nixos/modules/config/xdg/portals/termfilechooser.nix";
+ nixvim = {
+ homeManagerModule = nixVim.homeManagerModules.nixvim;
+ };
agenix = agenix.nixosModules.default;
disko = disko.nixosModules.default;
serverphone = serverphone.nixosModules.default;
diff --git a/tests/by-name/nv/nvim-checkhealth/test.desc b/tests/by-name/nv/nvim-checkhealth/test.desc
new file mode 100644
index 00000000..66f87cf4
--- /dev/null
+++ b/tests/by-name/nv/nvim-checkhealth/test.desc
@@ -0,0 +1,22 @@
+# Give the shell time to start up
+Sleep 2
+
+# We open a `*.norg` file to run the norg ftplugin.
+Type nvim test.norg --headless "+set nospell" "+checkhealth" "+w! health.log" +q +wa +qa
+Sleep 0.5
+Type Enter
+
+# TODO: The test system should be able to just wait until a command has finished. <2024-11-23>
+# Wait until `nvim` has collected the health check.
+Sleep 240
+
+# The `checkhealth` output is not reproducible.
+# Thus only output the warnings/errors.
+Type batgrep --ignore-case 'warning|error' health.log > new_golden
+Sleep 0.5
+Type Enter
+Sleep 2
+
+SetGolden new_golden
+
+# vim: ft=tape
diff --git a/tests/by-name/nv/nvim-checkhealth/test.nix b/tests/by-name/nv/nvim-checkhealth/test.nix
new file mode 100644
index 00000000..d84a2627
--- /dev/null
+++ b/tests/by-name/nv/nvim-checkhealth/test.nix
@@ -0,0 +1,44 @@
+{
+ mkTest,
+ extraModules,
+ pkgs,
+ ...
+}:
+mkTest {
+ name = "nvim-checkhealth";
+
+ configuration = {
+ imports = [
+ ../../../../modules/by-name/nv/nvim/module.nix
+ ../../../../modules/by-name/ni/nixpkgs/module.nix
+ ];
+ config = {
+ soispha = {
+ nixpkgs = {
+ enable = true;
+ systemName = "x86_64-linux";
+ };
+ programs.nvim = {
+ enable = true;
+ shell = pkgs.zsh;
+ };
+ };
+ home-manager.users.soispha = {
+ home.packages = [
+ pkgs.bat
+ pkgs.ripgrep
+ pkgs.bat-extras.batgrep
+ ];
+ imports = [
+ extraModules.nixvim.homeManagerModule
+ ];
+ };
+ };
+ };
+
+ testData = {};
+
+ description = ./test.desc;
+
+ hash = "4927ff94c6e9fb0dcb25c8e3e30f3e489cab5bb0a054656776af19725308bfe1";
+}
diff --git a/tests/default.nix b/tests/default.nix
index 9803c99c..1f2ea049 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -26,6 +26,9 @@
import value {
inherit
mkTest
+ extraModules
+ pkgs
+ myPkgs
;
};
};