When debugging Rust unit tests in vscode on MacOS, the breakpoints don't trigger

246 views Asked by At

I am trying to debug a set of Cucumber Rust tests in Visual Studio Code. I think that I've figured out how to configure launch.json and tasks.json to allow me to test only one test at a time. However, the debugger is completely ignoring my breakpoints. It just runs the test like they aren't even there. How should my setup be configured?

This is my launch.json:

{
    "type": "lldb",
    "request": "launch",
    "name": "Debug unit tests in executable 'my_project'",
    "cargo": {
        "args": [
            "test",
            "--no-run",
            "--bin=my_project",
            "--package=my_project",
        ],
        "filter": {
            "name": "my_project",
            "kind": "bin"
        }
    },
    "args": [],
    "cwd": "${workspaceFolder}",
    "postDebugTask": "cargo test cucumber_test_1",

}

This is my tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cargo",
            "command": "test",
            "args": ["--test", "cucumber_test_1"],
            "problemMatcher": [
                "$rustc"
            ],
            "group": "test",
            "label": "cargo test cucumber_test_1"
        }
    ]
}

Here is a simplified version of the project structure:

main project directory
├── Cargo.lock
├── Cargo.toml
├── src
│   ├── main.rs
├── tests
│   ├── features
│   │    └── cucumber_test_1.feature
│   ├── cucumber_test_1.rs
│   └── enviro.rs    

Here is a screenshot of my settings: vscode settings

I've read through a lot of stackoverflow questions and tutorials, but I can't find anything that is specific enough to my test setup. Any help is appreciated!

0

There are 0 answers