mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-04 22:34:31 +02:00
tests: Allow to skip running neovim (#260)
Some plugins don't really play nicely with being launched in a headless sandboxed environment. This adds the pseudo option 'tests.dontRun' to avoid running those tests
This commit is contained in:
parent
2a3d497d29
commit
f5f33b5390
2 changed files with 23 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
||||||
checkNvim = {
|
checkNvim = {
|
||||||
name,
|
name,
|
||||||
nvim,
|
nvim,
|
||||||
|
dontRun,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
|
@ -14,13 +15,17 @@
|
||||||
#
|
#
|
||||||
# Because neovim does not return an exitcode when quitting we need to check if there are
|
# Because neovim does not return an exitcode when quitting we need to check if there are
|
||||||
# errors on stderr
|
# errors on stderr
|
||||||
buildPhase = ''
|
buildPhase =
|
||||||
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null)
|
if !dontRun
|
||||||
if [[ -n $output ]]; then
|
then ''
|
||||||
echo "ERROR: $output"
|
output=$(HOME=$(realpath .) nvim -mn --headless "+q" 2>&1 >/dev/null)
|
||||||
exit 1
|
if [[ -n $output ]]; then
|
||||||
fi
|
echo "ERROR: $output"
|
||||||
'';
|
exit 1
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
else ''
|
||||||
|
'';
|
||||||
|
|
||||||
# If we don't do this nix is not happy
|
# If we don't do this nix is not happy
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
|
@ -9,8 +9,17 @@ in
|
||||||
# We attempt to build & execute all configurations
|
# We attempt to build & execute all configurations
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: config: let
|
name: config: let
|
||||||
nvim = makeNixvim config;
|
testAttributes =
|
||||||
|
if builtins.hasAttr "tests" config
|
||||||
|
then config.tests
|
||||||
|
else {
|
||||||
|
dontRun = false;
|
||||||
|
};
|
||||||
|
nvim = makeNixvim (pkgs.lib.attrsets.filterAttrs (n: _: n != "tests") config);
|
||||||
in
|
in
|
||||||
checkConfig {inherit name nvim;}
|
checkConfig {
|
||||||
|
inherit name nvim;
|
||||||
|
inherit (testAttributes) dontRun;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
tests
|
tests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue