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

earthnutDev / a-node-tools / 14630860861

24 Apr 2025 12:38AM UTC coverage: 39.098% (+6.2%) from 32.891%
14630860861

push

github

earthnutDev
version: 2.2.0 2025-04-24 08:38:51 没啥,更新着玩 😄

71 of 182 branches covered (39.01%)

Branch coverage included in aggregate %.

2 of 3 new or added lines in 2 files covered. (66.67%)

58 existing lines in 6 files now uncovered.

137 of 350 relevant lines covered (39.14%)

1.44 hits per line

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

0.0
/src/path/initializeFile.ts
1
import { fileURLToPath } from 'node:url';
2
import { isWindows } from './isWindows';
×
3
import { getCallerFilename } from './getCallerFileInfo';
×
4
import { dirname } from 'node:path';
×
5
import { _p } from 'src/print';
×
6

×
7
/**
×
UNCOV
8
 *
×
9
 * ## 初始化 `__filename` 和 `__dirname`
10
 *
11
 * @returns   [__filename,__dirname]
12
 */
13
export function initializeFile(): [string, string] {
14
  /** 文件地址  */
15
  let a: string;
16
  /** 文件躲在目录地址  */
17
  try {
18
    new Function('import("")');
19
    a = fileURLToPath(import.meta.url);
×
20
  } catch (error) {
×
UNCOV
21
    if (process.env.A_NODE_TOOLS_DEV === 'true') {
×
22
      _p(error);
23
    }
24
    a = __filename;
×
UNCOV
25
  }
×
26
  if (isWindows) {
27
    a = a.replace(/\\/gm, '/');
×
28
  }
29
  a = getCallerFilename(a);
×
30
  const b: string = dirname(a);
×
31
  return [a, b];
UNCOV
32
}
×
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