• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / cloud-foundry-tools-api / 4173844924

pending completion
4173844924

Pull #161

github

GitHub
Merge 8ead83807 into cd358e984
Pull Request #161: feat: add quote-vcap flag to bind-local

187 of 188 branches covered (99.47%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

468 of 471 relevant lines covered (99.36%)

11.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/task.ts
1
import * as fs from "fs";
1✔
2
import * as path from "path";
1✔
3
import * as _ from "lodash";
1✔
4
import { parse, stringify } from "comment-json";
1✔
5

6
const DEFAULT_TASKS_JSON_CONTENT: unknown = { version: "2.0.0", tasks: [] };
1✔
7

8
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9
async function getTaskJsonContentAsJsonObject(taskJsonFilePath: string): Promise<any> {
10
  try {
5✔
11
    const tasksJsonString = await fs.promises.readFile(taskJsonFilePath, { encoding: "utf8" });
5✔
12
    const tasksJson: unknown = parse(tasksJsonString);
4✔
13
    // eslint-disable-next-line @typescript-eslint/no-unsafe-return
14
    return _.assign(DEFAULT_TASKS_JSON_CONTENT, tasksJson);
3✔
15
  } catch (e) {
16
    // ignore, probably file or folder is missing
17
    // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
    return DEFAULT_TASKS_JSON_CONTENT;
2✔
19
  }
20
}
21

22
// eslint-disable-next-line @typescript-eslint/no-explicit-any
23
export async function saveTaskConfiguration(wsFolderPath: string, configuration: any): Promise<void> {
1✔
24
  const taskJsonFilePath = path.join(wsFolderPath, ".vscode", "tasks.json");
5✔
25
  const tasksJson = await getTaskJsonContentAsJsonObject(taskJsonFilePath);
5✔
26

27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
  const existingTaskindex = tasksJson.tasks.findIndex((task: any) => task.label === configuration.label);
5✔
29
  if (existingTaskindex >= 0) {
5✔
30
    tasksJson.tasks[existingTaskindex] = configuration;
3✔
31
  } else {
32
    tasksJson.tasks.push(configuration);
2✔
33
  }
34

35
  await fs.promises.writeFile(taskJsonFilePath, stringify(tasksJson, undefined, "  "));
5✔
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc