diff options
author | vsrs <[email protected]> | 2020-07-02 19:33:26 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-07-03 12:23:51 +0100 |
commit | 271abb7bc43f11c9b9e9c1353b162d9d267b1d21 (patch) | |
tree | 5bf0cbdcbfa09535dca9db7cc02cbc4d6153889a /editors/code/src/run.ts | |
parent | 7b79d24ad5b251c0806a07aa7769e824f3c37fec (diff) |
Add tests
Diffstat (limited to 'editors/code/src/run.ts')
-rw-r--r-- | editors/code/src/run.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index d7c7c489c..4a5c6ad41 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -5,7 +5,7 @@ import * as tasks from './tasks'; | |||
5 | 5 | ||
6 | import { Ctx } from './ctx'; | 6 | import { Ctx } from './ctx'; |
7 | import { makeDebugConfig } from './debug'; | 7 | import { makeDebugConfig } from './debug'; |
8 | import { Config } from './config'; | 8 | import { Config, RunnableEnvCfg } from './config'; |
9 | 9 | ||
10 | const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; | 10 | const quickPickButtons = [{ iconPath: new vscode.ThemeIcon("save"), tooltip: "Save as a launch.json configurtation." }]; |
11 | 11 | ||
@@ -96,22 +96,22 @@ export class RunnableQuickPick implements vscode.QuickPickItem { | |||
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | export function prepareEnv(runnable: ra.Runnable, config: Config): Record<string, string> { | 99 | export function prepareEnv(runnable: ra.Runnable, runnableEnvCfg: RunnableEnvCfg): Record<string, string> { |
100 | const env: Record<string, string> = { "RUST_BACKTRACE": "short" }; | 100 | const env: Record<string, string> = { "RUST_BACKTRACE": "short" }; |
101 | 101 | ||
102 | if (runnable.args.expectTest) { | 102 | if (runnable.args.expectTest) { |
103 | env["UPDATE_EXPECT"] = "1"; | 103 | env["UPDATE_EXPECT"] = "1"; |
104 | } | 104 | } |
105 | 105 | ||
106 | if (config.runnableEnv) { | 106 | if (runnableEnvCfg) { |
107 | if (Array.isArray(config.runnableEnv)) { | 107 | if (Array.isArray(runnableEnvCfg)) { |
108 | for (const it of config.runnableEnv) { | 108 | for (const it of runnableEnvCfg) { |
109 | if (!it.mask || new RegExp(it.mask).test(runnable.label)) { | 109 | if (!it.mask || new RegExp(it.mask).test(runnable.label)) { |
110 | Object.assign(env, it.env); | 110 | Object.assign(env, it.env); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | } else { | 113 | } else { |
114 | Object.assign(env, config.runnableEnv as Record<string, string>); | 114 | Object.assign(env, runnableEnvCfg as Record<string, string>); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
@@ -136,7 +136,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
136 | command: args[0], // run, test, etc... | 136 | command: args[0], // run, test, etc... |
137 | args: args.slice(1), | 137 | args: args.slice(1), |
138 | cwd: runnable.args.workspaceRoot, | 138 | cwd: runnable.args.workspaceRoot, |
139 | env: prepareEnv(runnable, config), | 139 | env: prepareEnv(runnable, config.runnableEnv), |
140 | }; | 140 | }; |
141 | 141 | ||
142 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() | 142 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() |