aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-27 16:53:50 +0100
committerAleksey Kladov <[email protected]>2020-06-27 18:22:31 +0100
commit03c5a6690d943e48ac5b5464c2ac2fd054ea6251 (patch)
treeffb971e1d7647f9c72a24210f63b265ebae23c23 /editors/code
parent491d000c27676305cc7d5d734d4476cf731b7940 (diff)
Add light-weight snapshot testing library with editor integration
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/lsp_ext.ts1
-rw-r--r--editors/code/src/run.ts6
2 files changed, 6 insertions, 1 deletions
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index e16ea799c..fdb99956b 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -60,6 +60,7 @@ export interface Runnable {
60 workspaceRoot?: string; 60 workspaceRoot?: string;
61 cargoArgs: string[]; 61 cargoArgs: string[];
62 executableArgs: string[]; 62 executableArgs: string[];
63 expectTest?: boolean;
63 }; 64 };
64} 65}
65export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); 66export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables");
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index 766b05112..e1430e31f 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -108,12 +108,16 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
108 if (runnable.args.executableArgs.length > 0) { 108 if (runnable.args.executableArgs.length > 0) {
109 args.push('--', ...runnable.args.executableArgs); 109 args.push('--', ...runnable.args.executableArgs);
110 } 110 }
111 const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" };
112 if (runnable.args.expectTest) {
113 env["UPDATE_EXPECT"] = "1";
114 }
111 const definition: tasks.CargoTaskDefinition = { 115 const definition: tasks.CargoTaskDefinition = {
112 type: tasks.TASK_TYPE, 116 type: tasks.TASK_TYPE,
113 command: args[0], // run, test, etc... 117 command: args[0], // run, test, etc...
114 args: args.slice(1), 118 args: args.slice(1),
115 cwd: runnable.args.workspaceRoot, 119 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),
117 }; 121 };
118 122
119 const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() 123 const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate()