Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Introduce a way to disable options when running in tests #1095

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

traxys
Copy link
Member

@traxys traxys commented Feb 14, 2024

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

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 nix-community#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 nix-community#1085
@traxys traxys requested a review from GaetanLepage February 14, 2024 22:39
Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit annoying that we have to do so much black magic but hey...
At least good job of figuring out this solution !

@traxys traxys merged commit 6d7e429 into nix-community:main Feb 15, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] mkTestDerivationFromNvim fails for image.nvim
2 participants