1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-21 17:59:41 +01:00

lib: move enableExceptInTests impl to build.test option

Simplify the `enableExceptInTests` attribute, removing the
`_nixvimTests` argument.

We now do a full re-eval of the nixvim configuration before building the
test, giving us a central place to implement `enableExceptInTests` and
its eventual replacement(s).

This extends support for `enableExceptInTests` to all methods of getting
a nixvim test derivation. Previously, it only worked when using `mkTestDerivationFromNixvimModule`.

In `tests/main.nix`, we avoid the re-eval by doing the initial eval with
a "test mode" lib from the start.
This commit is contained in:
Matt Sturgeon 2025-11-19 07:07:02 +00:00
parent 7754b4eb1b
commit 8d0ca9abc4
7 changed files with 57 additions and 31 deletions

View file

@ -15,9 +15,8 @@ let
{
assertions = [
{
# FIXME: should be false
assertion = lib.nixvim.enableExceptInTests;
message = "Expected lib.nixvim.enableExceptInTests to be true";
assertion = !lib.nixvim.enableExceptInTests;
message = "Expected lib.nixvim.enableExceptInTests to be false";
}
{
# NOTE: evaluating `helpers` here prints an eval warning

View file

@ -9,10 +9,24 @@
let
fetchTests = callTest ./fetch-tests.nix { };
# Avoid `build.test` re-evaluating its nixvim configuration by providing a
# "test mode" lib from the start
testLib = lib.extend (
final: prev: {
nixvim = prev.nixvim.extend (
final: prev: {
utils = prev.utils // {
enableExceptInTests = false;
};
}
);
}
);
moduleToTest =
file: name: module:
let
configuration = lib.nixvim.modules.evalNixvim {
configuration = testLib.nixvim.modules.evalNixvim {
modules = [
{
test.name = lib.mkDefault name;