Code Monkey home page Code Monkey logo

neotest-rust's Introduction

neotest-rust

Neotest adapter for Rust, using cargo-nextest.

Requires nvim-treesitter and the parser for Rust.

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

If you wish to give additional arguments to the cargo nextest, you can specify the args when initializing the adapter.

require("neotest").setup({
  adapters = {
    require("neotest-rust") {
        args = { "--no-capture" },
    }
  }
})

Supports standard library tests, rstest, Tokio's [#tokio::test], and more. Does not support rstest's parametrized tests.

Debugging Tests

Codelldb is the default adapter used for debugging. Alternatives can be specified via the dap_adapter property during initialization.

require("neotest").setup({
  adapters = {
    require("neotest-rust") {
        args = { "--no-capture" },
        dap_adapter = "lldb",
    }
  }
})

See nvim-dap, and rust-tools#debugging if you are using rust-tools.nvim, for more information.

Limitations

The following limitations apply to both running and debugging tests.

  • Assumes unit tests in main.rs, mod.rs, and lib.rs are in a tests module.
  • Does not support rstest's #[case] macro.
  • When running tests for a main.rs in an integration test subdirectory (e.g. tests/testsuite/main.rs), all tests in that subdirectory will be run (e.g. all tests in tests/testsuite/). This is because Cargo lacks the capability to specify a test file.

Additionally, when debugging tests, no output from failed tests will be captured in the results provided to Neotest.

neotest-rust's People

Contributors

rouge8 avatar pre-commit-ci[bot] avatar andy-bell101 avatar bram209 avatar erezamihud avatar danielvoogsgerd avatar morgsmccauley avatar tkmpypy avatar jsiefer avatar rareitems avatar dependabot[bot] avatar tylersouthwick avatar muniftanjim avatar mrcjkb avatar jesse-bakker avatar igorlfs avatar frederick888 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.