Hecatoncheir / neotest-dart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

neotest-dart

This plugin provides a Dart and Flutter tests adapter for the Neotest framework.

Installation

Using packer:

use({
  'nvim-neotest/neotest',
  requires = {
    ...,
    'sidlatau/neotest-dart',
  }
  config = function()
    require('neotest').setup({
      ...,
      adapters = {
        require('neotest-dart') {
             command = 'flutter', -- Command being used to run tests. Defaults to `flutter`
                                  -- Change it to `fvm flutter` if using FVM
                                  -- change it to `dart` for Dart only tests
             use_lsp = true,      -- When set Flutter outline information is used when constructing test name.
             -- Useful when using custom test names with @isTest annotation
             custom_test_method_names = {},
      }
    })
  end
})

Usage

For usage of Neotest plugin please refer to Neotest usage section

When use_lsp is set, plugin attaches to dartls server and listens for outline changes. LSP outline handles more complex test names. Example of the test, that does not work with TreeSitter, but works when use_lsp setting is enabled:

  testWidgets('a' 'b', (tester) async {
    expect(true, false);
  });

Contributing

This project is maintained by the Neovim Dart/Flutter community. Please raise a PR if you are interested in adding new functionality or fixing any bugs If you are unsure of how this plugin works please read the Writing adapters section of the Neotest README. When submitting a bug, please include an example spec that can be tested.

About


Languages

Language:Lua 100.0%