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

pmcelhaney / counterfact / 10583233432

27 Aug 2024 05:48PM UTC coverage: 82.599% (+0.2%) from 82.44%
10583233432

Pull #902

github

pmcelhaney
finally got everything working with ESLint 9
Pull Request #902: chore(deps): update dependency eslint to v9

1001 of 1114 branches covered (89.86%)

Branch coverage included in aggregate %.

26 of 30 new or added lines in 10 files covered. (86.67%)

2 existing lines in 2 files now uncovered.

3233 of 4012 relevant lines covered (80.58%)

42.37 hits per line

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

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

2✔
3
import { CHOKIDAR_OPTIONS } from "../server/constants.js";
2✔
4
import { waitForEvent } from "../util/wait-for-event.js";
2✔
5
import { generate } from "./generate.js";
2✔
6

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

8✔
10
  private readonly destination: string;
8✔
11

8✔
12
  private readonly generateOptions: { routes: boolean; types: boolean };
8✔
13

8✔
14
  private watcher: FSWatcher | undefined;
8✔
15

8✔
16
  public constructor(
8✔
17
    openApiPath: string,
8✔
18
    destination: string,
8✔
19
    generateOptions: { routes: boolean; types: boolean },
8✔
20
  ) {
8✔
21
    super();
8✔
22
    this.openapiPath = openApiPath;
8✔
23
    this.destination = destination;
8✔
24
    this.generateOptions = generateOptions;
8✔
25
  }
8✔
26

8✔
27
  public async generate() {
8✔
28
    await generate(this.openapiPath, this.destination, this.generateOptions);
4✔
29
  }
4✔
30

8✔
31
  public async watch() {
8✔
32
    if (this.openapiPath.startsWith("http")) {
4!
33
      return;
×
34
    }
×
35

4✔
36
    this.watcher = watch(this.openapiPath, CHOKIDAR_OPTIONS).on(
4✔
37
      "change",
4✔
38
      () => {
4✔
39
        void generate(
4✔
40
          this.openapiPath,
4✔
41
          this.destination,
4✔
42
          this.generateOptions,
4✔
43
        ).then(
4✔
44
          () => {
4✔
45
            this.dispatchEvent(new Event("generate"));
4✔
46

4✔
47
            return true;
4✔
48
          },
4✔
49
          () => {
4✔
NEW
50
            this.dispatchEvent(new Event("failed"));
×
NEW
51

×
NEW
52
            return false;
×
NEW
53
          },
×
54
        );
4✔
55
      },
4✔
56
    );
4✔
57

4✔
58
    await waitForEvent(this.watcher, "ready");
4✔
59
  }
4✔
60

8✔
61
  public async stopWatching(): Promise<void> {
8✔
62
    await this.watcher?.close();
6✔
63
  }
6✔
64
}
8✔
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