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

Commit 5e164d8

Browse files
committed
Add light-weight snapshot testing library with editor integration
1 parent 2cb8b60 commit 5e164d8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

rust-analyzer/editors/code/src/lsp_ext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface Runnable {
6060
workspaceRoot?: string;
6161
cargoArgs: string[];
6262
executableArgs: string[];
63+
expectTest?: boolean;
6364
};
6465
}
6566
export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables");

rust-analyzer/editors/code/src/run.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,16 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
108108
if (runnable.args.executableArgs.length > 0) {
109109
args.push('--', ...runnable.args.executableArgs);
110110
}
111+
const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" };
112+
if (runnable.args.expectTest) {
113+
env["UPDATE_EXPECT"] = "1";
114+
}
111115
const definition: tasks.CargoTaskDefinition = {
112116
type: tasks.TASK_TYPE,
113117
command: args[0], // run, test, etc...
114118
args: args.slice(1),
115119
cwd: runnable.args.workspaceRoot,
116-
env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }),
120+
env: Object.assign({}, process.env as { [key: string]: string }, env),
117121
};
118122

119123
const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate()

0 commit comments

Comments
 (0)