github
1327 of 1482 branches covered (89.54%)
Branch coverage included in aggregate %.
129 of 160 new or added lines in 12 files covered. (80.63%)
13 existing lines in 5 files now uncovered.5338 of 9055 relevant lines covered (58.95%)
31.22 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✔ |