(value: string, lineNumber: number)
| 1147 | } |
| 1148 | |
| 1149 | function parseSmokeEnvFileValue(value: string, lineNumber: number): string { |
| 1150 | if (!value) { |
| 1151 | return ""; |
| 1152 | } |
| 1153 | |
| 1154 | const quote = value[0]; |
| 1155 | if (quote === "\"" || quote === "'") { |
| 1156 | if (!value.endsWith(quote)) { |
| 1157 | throw new SmokeCliError({ |
| 1158 | code: "feishu.smoke.invalid_env_file", |
| 1159 | message: `Invalid --env-file line ${lineNumber}: unterminated quoted value.`, |
| 1160 | reason: "unterminated_quoted_value", |
| 1161 | }); |
| 1162 | } |
| 1163 | const inner = value.slice(1, -1); |
| 1164 | return quote === "\"" ? unescapeDoubleQuotedEnvValue(inner) : inner; |
| 1165 | } |
| 1166 | |
| 1167 | const commentIndex = value.search(/\s#/); |
| 1168 | return (commentIndex === -1 ? value : value.slice(0, commentIndex)).trim(); |
| 1169 | } |
| 1170 | |
| 1171 | function unescapeDoubleQuotedEnvValue(value: string): string { |
| 1172 | return value |
no test coverage detected