Skip to content

Latest commit

 

History

History
90 lines (68 loc) · 2.42 KB

README.md

File metadata and controls

90 lines (68 loc) · 2.42 KB

neotest-scala

Hero image

!!! DISCLAIMER

This is a fork of original neotest-scala, huge thanks to Stevan Milic for making and maintaining this plugin.

Please use it at your own risk, any improvement proposals and contributions are welcome.

About

Neotest adapter for Scala.

Supports the following Scala testing libraries:

Runs tests with sbt.
Requires nvim-metals to get project metadata information

Installation

Using lazy.nvim:

  {
    'nvim-neotest/neotest',
    dependencies = {
      'nvim-neotest/neotest-plenary',
      'olisikh/neotest-scala'
    },
  },

Configuration

require("neotest").setup({
  adapters = {
    require("neotest-scala")
  }
})

You may override some arguments that are passed into the build tool when you are running tests:

require("neotest").setup({
  adapters = {
    require("neotest-scala")({
      args = { "--no-colors" },
    })
  }
})

Also you have an option to dynamically specify args for SBT:

require("neotest").setup({
  adapters = {
    require("neotest-scala")({
      args = function(args)
        -- args table contains:
        --   path - full path to the file where test is executed
        --   framework - test library name that your test is implemented with
        --   project_name - project name the test is running on
        --   build_target_info - information about the build target collected from Metals

        return { "-v" }
      end,
    })
  }
})

Debugging

Plugin also supports debugging tests with nvim-dap (requires nvim-metals).
You can debug individual test cases as well, but note that utest framework doesn't support this because it doesn't implement sbt.testing.TestSelector.
To run tests with debugger pass strategy = "dap" when running neotest:

require('neotest').run.run({strategy = 'dap'})