cucumber-rs / cucumber

Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.
https://cucumber-rs.github.io/cucumber/main
Apache License 2.0
563 stars 69 forks source link

rust-analyzer debug feature fails in vscode #307

Open Alphapage opened 11 months ago

Alphapage commented 11 months ago

Hello,

Scenario: Unsuccessfull debug from vscode file
    Given a developer who uses vscode
    When he clicks debug at the top of main function generated by rust-analyzer
    Then debug fails with "Failed to parse: Failed to parse feature: Could not read path:" even if the absolute path is set as input

From my first investigation, it seems cucumber is trying to merge path from its own crate location, instead of the testing crate path. If I create a launch.json debug configuration, then I don't have any problem: the test is running as expected.

Thank you in advance for your help.

tyranron commented 11 months ago

@Alphapage I'm not VSCode user, so didn't hit such problem. Could you specify which command is run when "Debug" is clicked?

Alphapage commented 11 months ago

Sorry, but it seems to be related to : https://github.com/rust-lang/rust-analyzer/issues/10408

Working config from launch.json:

{
            "type": "lldb",
            "request": "launch",
            "name": "Debug integration test 'cucumber'",
            "cargo": {
                "args": [
                    "test",
                    "--no-run",
                    "--test=cucumber",
                    "--package=dev"
                ],
                "filter": {
                    "name": "cucumber",
                    "kind": "test"
                }
            },
            "args": [],
            "cwd": "${workspaceFolder}"
        }

Rust-analyzer debug lens config:

{
  "type": "lldb",
  "request": "launch",
  "name": "run cucumber",
  "program": "/Users/desktop/dev/target/debug/deps/cucumber-5d6945f264a7a24d",
  "args": [],
  "cwd": "/Users/desktop/dev",
  "sourceMap": {},
  "sourceLanguages": [
    "rust"
  ],
  "env": {
    "RUST_BACKTRACE": "short",
    "COMMAND_MODE": "unix2003",
    "HOME": "/Users/desktop",
    "HOMEBREW_CELLAR": "/opt/homebrew/Cellar",
    "HOMEBREW_PREFIX": "/opt/homebrew",
    "HOMEBREW_REPOSITORY": "/opt/homebrew",
    "INFOPATH": "/opt/homebrew/share/info:",
    "LOGNAME": "desktop",
    "LaunchInstanceID": "821CDDA6-A04D-4480-B374-91A3ED30BC08",
    "MANPATH": "/opt/homebrew/share/man::",
    "MallocNanoZone": "0",
    "OLDPWD": "/",
    "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
    "PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/desktop/.cargo/bin:/Users/desktop/dev/bin",
    "PWD": "/",
    "SECURITYSESSIONID": "186a3",
    "SHELL": "/bin/zsh",
    "SHLVL": "0",
    "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.MeZJWHAoqG/Listeners",
    "TMPDIR": "/var/folders/3v/j9vt6qc502b5ht2p8w_9c76m0000gn/T/",
    "USER": "desktop",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_CODE_CACHE_PATH": "/Users/desktop/Library/Application Support/Code/CachedData/f1b07bd25dfad64b0167beb15359ae573aecd2cc",
    "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
    "VSCODE_CWD": "/",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_IPC_HOOK": "/Users/desktop/Library/Application Support/Code/1.83-main.sock",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en-gb\",\"osLocale\":\"en-fr\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
    "VSCODE_PID": "544",
    "XPC_FLAGS": "0x0",
    "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.41679192.41679198",
    "_": "/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
    "__CFBundleIdentifier": "com.microsoft.VSCode",
    "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
    "ELECTRON_RUN_AS_NODE": "1"
  }
}