Giter Club home page Giter Club logo

Comments (10)

rouge8 avatar rouge8 commented on June 12, 2024 1

@rouge8 Same here screenshot_2023-08-12_20-18-21_519476446

It seems the right command should be cargo test not cargo nextest

No, that's not correct. As it says in the README, this plugin works with cargo-nextest.

from neotest-rust.

rouge8 avatar rouge8 commented on June 12, 2024

Can you provide an example that triggers this?

from neotest-rust.

tubzby avatar tubzby commented on June 12, 2024

I was running this simple code:

#[cfg(test)]
mod tests {
    #[test]
    fn test() {
        let mut i: u8 = 255;
        i += 1;
    }
}

For some reason, it works now.

from neotest-rust.

tubzby avatar tubzby commented on June 12, 2024

Sorry for the last post, this test fails:

#[cfg(test)]
mod tests {
    #[test]
    fn test() {
        let mut i: u8 = 255;
        i = i.wrapping_add(1);
        assert_eq!(i, 0);
    }
}

from neotest-rust.

rouge8 avatar rouge8 commented on June 12, 2024

Seems to work for me, running neotest on this main.rs:

fn main() {
    println!("Hello, world!");
}

#[cfg(test)]
mod tests {
    #[test]
    fn test() {
        let mut i: u8 = 255;
        i = i.wrapping_add(1);
        assert_eq!(i, 0);
    }
}

from neotest-rust.

henriquemelicias avatar henriquemelicias commented on June 12, 2024

@tubzby , did you try installing cargo-nextest with cargo install cargo-nextest --locked? I was getting the same error but that fixed it.

from neotest-rust.

tubzby avatar tubzby commented on June 12, 2024

It works now, I'm not sure what happened, sometimes when I run a test with key bindings, nothing happens, I have to switch to vs code to run the unit test.

Are there any logs that I can look into?

from neotest-rust.

Zeioth avatar Zeioth commented on June 12, 2024

@rouge8 Same here
screenshot_2023-08-12_20-18-21_519476446

It seems the right command should be cargo test not cargo nextest

from neotest-rust.

Zeioth avatar Zeioth commented on June 12, 2024

yes thank you, doing cargo install nextest seems to do the trick
screenshot_2023-08-12_21-42-39_205460188

from neotest-rust.

solc42 avatar solc42 commented on June 12, 2024

@rouge8 Hello!

I'v faced the same problem, at least the error I receive is the same as OP, but in my case I found out the reason.

I copied args for initialization from example:

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

That lead to cargo launches with args like

cargo nextest run --no-fail-fast --config-file /var/folders/0y/gvl9x07x341fhm6zq23ps9480000gn/T/nvim.coin/ROMNaO/0.nextest.toml --profile neotest --no-capture -E 'test(/^tests::/)'

And --no-capture lead to empty system-out/system-err nodes in xml result:

        <testcase name="tests::test_ref" classname="lobster-proxy::bin/lobster-proxy" timestamp="2023-08-12T22:26:57.410+00:00" time="0.004">
            <failure type="test failure"/>
            <system-out></system-out>
            <system-err></system-err>
        </testcase>

so the input to parse_errors method become nil.

I guarded with simple precheck for nil in local version like:

function M.parse_errors(output)
    if output == nil then
        return {}
    end
    local message, line = output:match("thread '[^']+' panicked at '([^']+)', [^:]+:(%d+):%d+")
<...>

It really took me a while, cause at the beginning I did know nothing about lua.

PS May be OP has another source of the problem, but i smashed my head a bit, before figuring out. Should I make a PR or it works like that by design?

from neotest-rust.

Related Issues (20)

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.