github
1325 of 1479 branches covered (89.59%)
Branch coverage included in aggregate %.
310 of 461 new or added lines in 14 files covered. (67.25%)
15 existing lines in 6 files now uncovered.5372 of 9158 relevant lines covered (58.66%)
30.81 hits per line
1 |
export abstract class ConfigBase<C extends Record<string, any>> { |
2✔ |
2 |
protected value: Required<C>;
|
|
3 |
|
46✔ |
4 |
// eslint disable: have to use generic type here
|
46✔ |
5 |
/* eslint-disable-next-line class-methods-use-this */
|
46✔ |
6 |
protected defaultConfig() {
|
|
7 |
return {} as Required<C>;
|
30✔ |
8 |
} |
30✔ |
9 |
|
46✔ |
10 |
constructor() { |
|
11 |
this.value = this.defaultConfig(); |
46✔ |
12 |
} |
46✔ |
13 |
|
46✔ |
14 |
public mergeConfig = (userCfg: C): Required<C> => {
|
|
15 |
this.value = {
|
28✔ |
16 |
/* c8 ignore next */
|
2✔ |
17 |
...this.defaultConfig(),
|
2✔ |
18 |
...userCfg, |
28✔ |
19 |
}; |
28✔ |
20 |
return this.value; |
28✔ |
21 |
}; |
2✔ |
22 |
|
2✔ |
23 |
get() { |
|
24 |
return this.value; |
110✔ |
25 |
} |
110✔ |
|
|
2✔ |
|
set<T extends keyof C>(key: T, val: C[T]) { |
2✔ |
NEW
|
this.value[key] = val;
|
× |
NEW
|
} |
× |
30 |
} |
2✔ |