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

pmcelhaney / counterfact / 7857330850

10 Feb 2024 08:49PM UTC coverage: 86.246% (+0.1%) from 86.138%
7857330850

Pull #764

github

web-flow
Merge branch 'main' into change-context-update-algorithm
Pull Request #764: change context update algorithm

874 of 963 branches covered (0.0%)

Branch coverage included in aggregate %.

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

2763 of 3254 relevant lines covered (84.91%)

40.75 hits per line

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

88.33
/src/server/code-generator.ts
1
import { type FSWatcher, watch } from "chokidar";
2✔
2

2✔
3
import { generate } from "../typescript-generator/generate.js";
2✔
4
import { waitForEvent } from "../util/wait-for-event.js";
2✔
5

2✔
6
export class CodeGenerator extends EventTarget {
2✔
7
  private readonly openapiPath: string;
4✔
8

4✔
9
  private readonly destination: string;
4✔
10

4✔
11
  private watcher: FSWatcher | undefined;
4✔
12

4✔
13
  public constructor(openApiPath: string, destination: string) {
4✔
14
    super();
4✔
15
    this.openapiPath = openApiPath;
4✔
16
    this.destination = destination;
4✔
17
  }
4✔
18

4✔
19
  public async watch() {
4✔
20
    await generate(this.openapiPath, this.destination);
4✔
21

4✔
22
    if (this.openapiPath.startsWith("http")) {
4!
23
      return;
×
24
    }
×
25

4✔
26
    this.watcher = watch(this.openapiPath).on("change", () => {
4✔
27
      // eslint-disable-next-line promise/prefer-await-to-then
2✔
28
      void generate(this.openapiPath, this.destination).then(
2✔
29
        () => {
2✔
30
          this.dispatchEvent(new Event("generate"));
2✔
31
          return true;
2✔
32
        },
2✔
33
        () => {
2✔
34
          this.dispatchEvent(new Event("failed"));
×
35
          return false;
×
36
        },
×
37
      );
2✔
38
    });
2✔
39

4✔
40
    await waitForEvent(this.watcher, "ready");
4✔
41
  }
4✔
42

4✔
43
  public async stopWatching(): Promise<void> {
4✔
44
    await this.watcher?.close();
4✔
45
  }
4✔
46
}
4✔
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

© 2025 Coveralls, Inc