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

pmcelhaney / counterfact / 8697996524

16 Apr 2024 12:29AM UTC coverage: 86.607% (+0.09%) from 86.517%
8697996524

Pull #852

github

web-flow
Merge branch 'main' into refactor-path-coder
Pull Request #852: Support OpenAPI reusable responses in global components object (handle $ref properly everywhere)

891 of 984 branches covered (90.55%)

Branch coverage included in aggregate %.

101 of 103 new or added lines in 8 files covered. (98.06%)

2 existing lines in 1 file now uncovered.

2879 of 3369 relevant lines covered (85.46%)

43.44 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