Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Debug Test uses file directory as cwd instead of workspace root #480

@whisper-bye

Description

@whisper-bye

When running Zig tests from the VS Code extension:

  • The Run profile uses the workspace folder as cwd (via getWorkspaceFolder(...)), which matches how zig test is usually run from the project root.
  • The Debug profile always uses the test file directory as cwd.

In src/zigTestRunnerProvider.ts, debugTest builds the test binary and then starts the debugger with:

const debugConfig: vscode.DebugConfiguration = {
    type: debugAdapter,
    name: `Debug ${testItem.label}`,
    request: "launch",
    program: testBinaryPath,
    cwd: path.dirname(testItem.uri.fsPath),
    stopAtEntry: false,
};

This makes std.fs.cwd() inside tests differ between Run and Debug (e.g. .../project/src vs .../project), and there is currently no setting to change this behavior (e.g. zig.debugTestArgs does not affect cwd).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions