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

Commit 4b871f1

Browse files
committed
make debug test binary name predictable and add some guidance on how to use the options with build scripts
1 parent c48cc94 commit 4b871f1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"${filter}",
130130
"${path}"
131131
],
132-
"description": "Arguments to pass to 'zig' for running tests. Supported variables: ${filter}, ${path}."
132+
"description": "Arguments to pass to 'zig' for running tests. Supported variables: ${filter}, ${path}.\n\nTo use test filter with a build script define a custom option to pass it to: `-Dtest-filter=${filter}`."
133133
},
134134
"zig.debugTestArgs": {
135135
"type": "array",
@@ -144,7 +144,7 @@
144144
"--test-no-exec",
145145
"-femit-bin=${binaryPath}"
146146
],
147-
"description": "Arguments to pass to 'zig' for debugging tests. Supported variables: ${filter}, ${path}, ${binaryPath}."
147+
"description": "Arguments to pass to 'zig' for debugging tests. Supported variables: ${filter}, ${path}, ${binaryPath}.\n\nTo debug a test with a build script add a step that installs the test binary at `zig-out/bin/debug-unit-tests`:\n```zig\nb.step(\"debug-test-unit\", \"Debug unit tests\").dependOn(&b.addInstallArtifact(unit_tests, .{ .dest_sub_path = \"debug-unit-tests\" }).step);\n```"
148148
},
149149
"zig.debugAdapter": {
150150
"scope": "resource",

src/zigTestRunnerProvider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,8 @@ export default class ZigTestRunnerProvider {
283283
}
284284

285285
const wsFolder = getWorkspaceFolder(testFilePath)?.uri.fsPath ?? path.dirname(testFilePath);
286-
const outputDir = path.join(wsFolder, "zig-out", "tmp-debug-build", "bin");
287-
const binaryName = `test-${path.basename(testFilePath, ".zig")}`;
288-
const binaryPath = path.join(outputDir, binaryName);
286+
const outputDir = path.join(wsFolder, "zig-out", "bin");
287+
const binaryPath = path.join(outputDir, "debug-unit-tests");
289288
await vscode.workspace.fs.createDirectory(vscode.Uri.file(outputDir));
290289

291290
const debugTestArgsConf = config.get<string[]>("debugTestArgs") ?? [];

0 commit comments

Comments
 (0)