Closed Chaitanyabsprip closed 2 years ago
Hmm, looks like treesitter is not enough to handle all edge cases when constructing test names. I see Dart Code uses LSP outline information to construct these names (https://github.com/Dart-Code/Dart-Code/blob/c056a71922918fff527726826fa12de7d0fa996a/src/shared/utils/outline_lsp.ts). I will investigate if it is possible to use this information here.
The quick workaround would be to use triple quotes:
test(
'''should return true when isRegistered is called with registered
service''', () {
appEventService.registerEventService(FakeEventService(), events: []);
expect(appEventService.isRegistered<FakeEventService>(), true);
});
I added the ability to use LSP information. @Chaitanyabsprip, you may try it using this config: Packer:
use {
"sidlatau/neotest-dart",
branch="lsp"
}
Adapter config:
require("neotest").setup {
adapters = {
require "neotest-dart" {
command = ...
use_lsp = true,
},
},
}
With LSP there is some delay until outline information is available. So if the test is started before the outline is available, the test will not be found. Not sure how to solve it. But maybe it is not a problem?
will test and get back to you
and for the delay, could you make a variable that shows whether it's ready or a method that's async and only completes when the outline is ready. This way the user can work around the delay
The kind of tests that have the description too long are not recognized by neotest-dart