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

electron / fiddle / 25524764571

07 May 2026 10:08PM UTC coverage: 88.802% (-0.1%) from 88.915%
25524764571

push

github

web-flow
build(deps): drop tmp dependency (#1936)

570 of 627 branches covered (90.91%)

Branch coverage included in aggregate %.

11 of 17 new or added lines in 3 files covered. (64.71%)

3617 of 4088 relevant lines covered (88.48%)

45.79 hits per line

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

56.25
/src/main/utils/tmp.ts
1
import * as crypto from 'node:crypto';
2
import * as fs from 'node:fs';
3
import * as os from 'node:os';
4
import * as path from 'node:path';
5

6
const TEMPLATE_PATTERN = /XXXXXX/;
5✔
7

8
let _gracefulCleanup = false;
5✔
9
const _pathsToCleanup: string[] = [];
5✔
10

11
export async function tmpName(options: { template: string }): Promise<string> {
12
  if (!TEMPLATE_PATTERN.test(options.template)) {
1✔
NEW
13
    throw new Error('Invalid template provided');
×
14
  }
15

16
  const tempPath = path
1✔
17
    .join(await fs.promises.realpath(os.tmpdir()), options.template)
18
    .replace(TEMPLATE_PATTERN, crypto.randomBytes(3).toString('hex'));
19
  _pathsToCleanup.push(tempPath);
1✔
20

21
  return tempPath;
1✔
22
}
23

24
export function dirSync(options: { prefix: string }): string {
NEW
25
  return fs.mkdtempSync(options.prefix);
×
26
}
27

28
export function setGracefulCleanup(): void {
NEW
29
  _gracefulCleanup = true;
×
30
}
31

32
process.addListener('exit', () => {
5✔
NEW
33
  if (_gracefulCleanup) {
×
NEW
34
    for (const tempPath of _pathsToCleanup) {
×
NEW
35
      fs.rmSync(tempPath, { recursive: true, force: true });
×
36
    }
37
  }
38
});
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