github
1034 of 1151 branches covered (89.83%)
Branch coverage included in aggregate %.
43 of 43 new or added lines in 4 files covered. (100.0%)
17 existing lines in 1 file now uncovered.3227 of 4019 relevant lines covered (80.29%)
47.61 hits per line
UNCOV
1
|
import fs from "node:fs/promises";
|
|
UNCOV
2
|
|
× |
UNCOV
3
|
import nodeFetch from "node-fetch";
|
× |
UNCOV
4
|
|
× |
UNCOV
5
|
export async function readFile(urlOrPath: string) { |
× |
UNCOV
6
|
if (urlOrPath.startsWith("http")) { |
× |
UNCOV
7
|
const response = await nodeFetch(urlOrPath);
|
× |
UNCOV
8
|
|
× |
UNCOV
9
|
return await response.text();
|
× |
UNCOV
10
|
} |
× |
UNCOV
11
|
|
× |
UNCOV
12
|
if (urlOrPath.startsWith("file")) { |
× |
UNCOV
13
|
return await fs.readFile(new URL(urlOrPath), "utf8"); |
× |
UNCOV
14
|
} |
× |
UNCOV
15
|
|
× |
UNCOV
16
|
return await fs.readFile(urlOrPath, "utf8"); |
× |
UNCOV
17
|
} |
× |