push
github
99 of 115 branches covered (86.09%)
Branch coverage included in aggregate %.
151 of 151 new or added lines in 10 files covered. (100.0%)
2088 of 3082 relevant lines covered (67.75%)
3.6 hits per line
1 |
import { readFile } from "fs/promises";
|
4✔ |
2 |
import { Keyable } from "../interfaces/keyable.js";
|
4✔ |
3 |
|
4✔ |
4 |
export class LokalisePkg { |
4✔ |
5 |
static pkgPath() {
|
|
6 |
return "../../package.json"; |
16✔ |
7 |
} |
16✔ |
8 |
|
4✔ |
9 |
static async getVersion(): Promise<string> { |
|
10 |
let pkg: Keyable | null; |
16✔ |
11 |
|
16✔ |
12 |
try {
|
16✔ |
13 |
pkg = JSON.parse( |
16✔ |
14 |
( |
16✔ |
15 |
await readFile(new URL(LokalisePkg.pkgPath(), import.meta.url))
|
16✔ |
16 |
).toString(), |
16✔ |
17 |
); |
16✔ |
18 |
} catch (_e) {
|
|
19 |
pkg = null; |
× |
20 |
} |
× |
21 |
|
16✔ |
22 |
return pkg ? pkg.version : "unknown"; |
|
23 |
} |
16✔ |
24 |
} |
4✔ |