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

electrode-io / electrode-native / 7581

24 Apr 2026 09:20AM UTC coverage: 56.608% (-11.2%) from 67.856%
7581

push

Azure Pipelines

web-flow
Merge pull request #1924 from electrode-io/npm-security-audit-fix

3600 of 7762 branches covered (46.38%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

1659 existing lines in 112 files now uncovered.

9425 of 15247 relevant lines covered (61.82%)

523.13 hits per line

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

10.2
/ern-cauldron-api/src/GitFileStore.ts
1
import BaseGit from './BaseGit';
4✔
2
import fs from 'fs-extra';
4✔
3
import path from 'path';
4✔
4
import { shell } from 'ern-core';
4✔
5
import { ICauldronFileStore } from './types';
6

7
export default class GitFileStore
4✔
8
  extends BaseGit
9
  implements ICauldronFileStore
10
{
11
  private readonly prefix: string;
12

13
  constructor({
14
    cauldronPath,
15
    repository,
16
    branch,
17
  }: {
18
    cauldronPath: string;
19
    repository?: string;
20
    branch: string;
21
  }) {
UNCOV
22
    super({ cauldronPath, repository, branch });
×
23
  }
24

25
  // ===========================================================
26
  // ICauldronFileAccess implementation
27
  // ===========================================================
28

29
  public async storeFile(
30
    filePath: string,
31
    content: string | Buffer,
32
    fileMode?: string,
33
  ) {
UNCOV
34
    await this.sync();
×
UNCOV
35
    const storeDirectoryPath = path.resolve(
×
36
      this.fsPath,
37
      path.dirname(filePath),
38
    );
UNCOV
39
    await fs.ensureDir(storeDirectoryPath);
×
UNCOV
40
    const pathToFile = path.resolve(
×
41
      storeDirectoryPath,
42
      path.basename(filePath),
43
    );
UNCOV
44
    await fs.writeFile(pathToFile, content, { flag: 'w' });
×
UNCOV
45
    if (fileMode) {
×
46
      shell.chmod(fileMode, pathToFile);
×
47
    }
UNCOV
48
    await this.git.add(pathToFile);
×
UNCOV
49
    if (!this.pendingTransaction) {
×
50
      await this.git.commit(`Add file ${filePath}`);
×
51
      await this.push();
×
52
    }
53
  }
54

55
  public async hasFile(filePath: string) {
UNCOV
56
    await this.sync();
×
UNCOV
57
    try {
×
UNCOV
58
      fs.statSync(this.pathToFile(filePath)).isFile();
×
59
      return true;
×
60
    } catch (e) {
UNCOV
61
      return false;
×
62
    }
63
  }
64

65
  public async getPathToFile(filePath: string): Promise<string | undefined> {
UNCOV
66
    await this.sync();
×
UNCOV
67
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
UNCOV
68
      return this.pathToFile(filePath);
×
69
    }
70
  }
71

72
  public async getFile(filePath: string): Promise<Buffer | undefined> {
73
    await this.sync();
×
74
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
75
      return fs.readFile(this.pathToFile(filePath));
×
76
    }
77
  }
78

79
  public async removeFile(filePath: string): Promise<boolean> {
80
    await this.sync();
×
81
    if (await fs.pathExists(this.pathToFile(filePath))) {
×
82
      await this.git.rm(this.pathToFile(filePath));
×
83
      if (!this.pendingTransaction) {
×
84
        await this.git.commit(`Remove file ${filePath}`);
×
85
        await this.push();
×
86
      }
87
      return true;
×
88
    }
89
    return false;
×
90
  }
91

92
  private pathToFile(filePath: string) {
UNCOV
93
    return path.join(this.fsPath, filePath);
×
94
  }
95
}
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