Commit graph

25 commits

Author SHA1 Message Date
Matt Sturgeon
990ef039f7
tests: move test derivations to tests/default.nix
Move the previous `default.nix` to `main.nix` so that `default.nix` can
be used for defining the set of all test derivations.

`main.nix` is imported by `default.nix`, but is only responsible for the
tests built from `tests/test-sources/`.
2024-10-18 20:51:30 +01:00
Matt Sturgeon
af650ba940
tests/lsp-servers: de-couple from grouped tests
Follow up to cab6b0c9fe
2024-10-10 21:50:23 +01:00
Matt Sturgeon
191b0a9502
treewide: avoid passing pkgs to our lib
In the two places where our "helpers" lib is exclusively internal
(flake module args and building the docs), we no longer supply `pkgs`.

In the other 4 locations, we now note why we still do in a comment.
2024-09-22 18:18:05 +01:00
Matt Sturgeon
fcb782cd9c
flake: add an empty nixvimConfiguration to the legacyPackages output 2024-09-15 18:59:52 +01:00
Matt Sturgeon
4e5bd1d79b
lib: segregate and deprecate functions that need pkgs
Splits everything that depends on a `pkgs` instance into an optional
attrs, allowing `helpers.nix` to be bootstrapped without `pkgs`.

This required some refactoring:
- `modules.specialArgs` is only available when `pkgs` is used
- `modules.specialArgsWith` now requires `defaultPkgs` be provided
- `builders.*` now have `*With` variants that take `pkgs` as an argument
  and a `withPkgs` function that returns the old interface
- Had to define the fixed part of `builders` outside the attrs for now,
  to avoid infinite recursion.
- The old `builders` are now deprecated, and print a warning when
  evaluated
- `withOptoinalFns` was introduced to merge the optional attrs into the
  final lib.
2024-09-13 19:05:26 +01:00
Matt Sturgeon
faff32b9f1
plugins/by-name: init
Add support for automatically importing any directories under
`plugins/by-name`.

Includes a validation test, which is run by CI and by the pre-commit hook.
2024-09-09 11:50:38 +01:00
Matt Sturgeon
e48da949cf
tests/package-options: init
The test ensures "package" options use a "literalExpression" in their
defaultText; i.e. it validates `lib.mkPackageOption` was used to build
the package options.

All options whose `default` is a derivation are covered by the test,
other than submodule sub-options.
2024-09-05 02:24:52 +01:00
Matt Sturgeon
1c879ec3aa
tests: add regression test for warnings + assertions
Ensure `mkTestDerivationFromNixvimModule` correctly test warnings & assertions.

Also did some minor cleanup:
- Call `failing-tests.nix` using `pkgs.callPackage`
- Replace repetive use of `testBuildFailure` with a wrapper
  `mkFailingNixvimTest`
2024-08-28 00:44:34 +01:00
Matt Sturgeon
60ea38d2c4
tests: test the tests
Adds a regression test for #2076. This test ensures that
`extraConfigLua` is used in `finalPackage` and that the test will fail
correctly when running `nvim` results in unexpected output.
2024-08-27 03:54:43 +01:00
Matt Sturgeon
cbd1003d9d
modules/test: move test derivation to an option
Introduced the `test.derivation` read-only option.
2024-08-21 02:48:00 +01:00
Matt Sturgeon
fc8155b5fa
tests/generated: init by checking declared tools
This moves most assertions out of generate-files and into a check
derivation. This should allow the CI to finish, even when there are
issues.

This also properly tests efmls, which was only checked partially before.

rust-analyzer is not covered because the existing assertions relate more
to edge-cases not handled by the generation script than the result it
builds.
2024-07-31 11:49:28 +01:00
traxys
b1576362a7 tests: Remove the test link farm
Fixes #1878
2024-07-21 15:17:17 +02:00
Matt Sturgeon
34c3c026b4
tests: add check for nixpkgs maintainers
The test fails if a nixvim maintainer is also a nixpkgs maintainer.
2024-07-10 09:18:18 +01:00
Matt Sturgeon
f11f991e09
flake/checks: test extraFiles are in the build 2024-07-07 16:43:06 +01:00
Matt Sturgeon
10f64e6c96
tests/test-derivation: allow tests to be modules
Use `mkTestDerivationFromNixvimModule` instead of `mkTestDerivation`,
allowing "proper" modules to be used instead of plain attr configs.

This is useful for more complex tests that wish to use `config` or
`options` arguments, e.g:

```nix
{config, options, ...}: {
  /* some cool test */
}
```

To allow `tests.dontRun` to be defined on such a test, the module is
allowed to be nested as `module`, e.g:

```nix
{
  tests.dontRun = true;
  module = {config, options, ...}: {
    /* a disabled test */
  };
}
```

Also ended up doing some general cleanup, removing an unused function,
etc.
2024-06-29 22:02:44 +01:00
traxys
62f32bfc71 treewide: Reformat with nixfmt 2024-05-05 22:00:40 +02:00
traxys
9cd3721adf
standalone: Allow to extend a standalone derivation with a new module (#1142)
This adds the `nixvimExtend` attribute to the generated standalone
derivation, this attribute takes a module as an argument and returns a
new standalone derivation with the initial module & the extended module
merged together.
2024-02-22 08:22:21 +01:00
traxys
dcbe894bea
Fix issue with non flake import (#1102)
* Update flake compat

* tests: Add a test without flakes
2024-02-15 22:51:26 +01:00
traxys
6d7e429537
tests: Introduce a way to disable options when running in tests (#1095)
In our basic template we used to provide a check based on
`mkTestDerivationFromNvim`. The issue with this check (that is handled
correctly internally) is that some plugins _can't_ be used in the test
environment, for example image.nvim like in #1085.

This commit introduces a new function to generate such checks,
`mkTestDerivationFromNixvimModule`, that wraps a nixvim configuration
instead of a built nvim instance.

Then a configuration can rely on the newly added
`helpers.enableExceptInTests` attribute to disable parts of the
configuration depending if it is evaluated in tests or in a real final
configuration.

Resolves #1085
2024-02-15 14:27:45 +01:00
Gaetan Lepage
a121d96091 tests: do not import helpers.nix directly 2024-02-11 11:50:35 +01:00
Gaetan Lepage
ed02648368 flake/wrappers: move wrappers checks to wrappers.nix 2024-01-06 18:20:46 +01:00
traxys
2167c1930c
tests: Add a test for nix-darwin modules (#909) 2024-01-06 18:03:44 +01:00
traxys
245930d735
tests: Add a test for the nixos module (#907) 2024-01-06 17:53:31 +01:00
traxys
96cdbc8177
tests: Add a test for the home-manager module (#901) 2024-01-06 17:31:17 +01:00
Gaetan Lepage
186fe574f9 flake: checks.nix -> tests.nix 2024-01-06 16:00:22 +01:00
Renamed from flake-modules/checks.nix (Browse further)