modules/test: check warnings/assertions#2048
modules/test: check warnings/assertions#2048mergify[bot] merged 3 commits intonix-community:mainfrom
Conversation
ec431f4 to
ba1db9f
Compare
|
I wonder if it'd be worth including a It may make the schemastore changes simpler, since we wouldn't have to avoid creating the warnings. |
My first reaction is that it would be nice to have that functionality. But, I'm trying to think of how often we'd do that. Are there cases that the test might include warnings and we need to silence them so we can keep the test enabled to watch for errors? That could be nice for maintenance. I think as long as we have inline notes around why a particular test's warnings are ignored, it shouldn't cause any serious negative side effects. |
ba1db9f to
2df6f22
Compare
The only other example is nvim-osc52, a plugin that prints a deprecation warning when enabled. I've updated this PR to just In the future we can extend the |
2df6f22 to
8f96181
Compare
I decided it wasn't too much work to just implement basic |
5a57f91 to
17bc33b
Compare
17bc33b to
92a9cc9
Compare
Warnings and assertions defined as `config.warnings` and `config.assertions` respectively will be checked as part of the test derivation, instead of when evaluating the modules. Adds new `checkWarnings` and `checkAssertions` test options (default true).
Follow up to a1a3488 Uses new `test.checkWarnings` option.
92a9cc9 to
0641962
Compare
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 0641962 |
Extracted from #1989 to reduce its scope. Also based on earlier work from #1986.
This PR moves responsibility for assertions/warnings in tests to the test derivation, instead of printing/throwing them.
They are still printed/thrown when building a non-test nixvim build.
Additionally, two new options are added to control this behaviour. Both default to
true:test.checkWarnings: Whether to checkconfig.warningsin the test.test.checkAssertions: Whether to checkconfig.assertionsin the test.Note
Only module warnings/assertions defined using the respective options from
assertions.nixare checked.Anything printed manually with
lib.warn,builtins.trace, etc, or errors thrown withassert,throw,abort, etc will not be handled correctly by the test.In the future we can expand on this to allow "expecting" assertions, which will make our test system more flexible.