Skip to content

Commit 3b04442

Browse files
committed
fix: test coverage
1 parent ad9bdf1 commit 3b04442

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

packages/fx-core/src/component/driver/file/createOrUpdateEnvironmentFile.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -162,29 +162,27 @@ export class CreateOrUpdateEnvironmentFileDriver implements StepDriver {
162162
envKey: string,
163163
envValue: string
164164
): Promise<Result<Void, FxError>> {
165-
if (!envValue) {
166-
return ok(Void);
167-
}
168-
169-
const placeHolderReg = /\${{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*}}/;
170-
const matches = placeHolderReg.exec(envValue);
171-
if (matches != null && matches.length > 1) {
172-
const envVarName = matches[1];
173-
const config =
174-
envVarConfigs.find((c) => c.envKey === envKey) || getGenericEnvVarConfig(envKey);
165+
if (envValue) {
166+
const placeHolderReg = /\${{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*}}/;
167+
const matches = placeHolderReg.exec(envValue);
168+
if (matches != null && matches.length > 1) {
169+
const envVarName = matches[1];
170+
const config =
171+
envVarConfigs.find((c) => c.envKey === envKey) || getGenericEnvVarConfig(envKey);
175172

176-
const result = await ctx.ui?.inputText({
177-
name: config.question.name,
178-
title: config.question.title as string,
179-
password: config.isPassword || config.question.password,
180-
validation: config.validation,
181-
});
173+
const result = await ctx.ui?.inputText({
174+
name: config.question.name,
175+
title: config.question.title as string,
176+
password: config.isPassword || config.question.password,
177+
validation: config.validation,
178+
});
182179

183-
if (result?.isErr()) {
184-
return result;
185-
} else if (result?.isOk() && result.value.result) {
186-
envOutput.set(envVarName, result.value.result);
187-
args.envs[envKey] = result.value.result;
180+
if (result?.isErr()) {
181+
return result;
182+
} else if (result?.isOk() && result.value.result) {
183+
envOutput.set(envVarName, result.value.result);
184+
args.envs[envKey] = result.value.result;
185+
}
188186
}
189187
}
190188
return ok(Void);

0 commit comments

Comments
 (0)