Skip to content

Foundry's Solidity test runner integrated into Neovim via Neotest

Notifications You must be signed in to change notification settings

llllvvuu/neotest-foundry

 
 

Repository files navigation

neotest-foundry

This plugin provides a Foundry adapter for the Neotest framework.

Credits to neotest-vitest and vscode-foundry-test-runner.

demo.mp4

Installation

{
  'nvim-neotest/neotest',
  dependencies = {
    ...,
    'llllvvuu/neotest-foundry',
  }
  config = {
    ...,
    adapters = {
      require('neotest-foundry')
    }
  }
}

Configuration

Defaults:

...
adapters = {
  require('neotest-foundry')({
    foundryCommand = "forge test", -- string | function
    foundryConfig = nil, -- string | function
    env = {}, -- table | function
    cwd = function () return lib.files.match_root_pattern("foundry.toml") end, -- string | function
    filterDir = function(name)
      return (
        name ~= "node_modules"
        and name ~= "cache"
        and name ~= "out"
        and name ~= "artifacts"
        and name ~= "docs"
        and name ~= "doc"
        -- and name ~= "lib"
      )
    end,
  })
}

Note on monorepos

If you start Neovim from the contracts directory instead of the monorepo root it should work. e.g. cd contracts/core && nvim

Testing

./scripts/test

About

Foundry's Solidity test runner integrated into Neovim via Neotest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 98.0%
  • Lua 1.9%
  • Other 0.1%