push
travis-pro
150 of 160 branches covered (93.75%)
Branch coverage included in aggregate %.
31 of 34 new or added lines in 3 files covered. (91.18%)
1 existing line in 1 file now uncovered.604 of 613 relevant lines covered (98.53%)
14.21 hits per line
|
|
|
1✔ |
|
|
let count = 0;
|
1✔ |
|
|
let isOpen = false;
|
1✔ |
|
|
|
|
|
|
export function add () {
|
|
|
|
if (isOpen) {
|
9✔ |
|
|
count = 1;
|
|
|
|
} else {
|
24✔ |
|
|
isOpen = true;
|
24✔ |
|
|
count++; |
24✔ |
| 11 |
} |
|
|
|
} |
1✔ |
| 13 |
|
1✔ |
|
|
const weakMap = new WeakMap<object, number>(); |
1✔ |
|
|
|
|
|
|
export function popTarget(target: object): boolean {
|
33✔ |
|
|
let count = weakMap.get(target); |
|
|
|
if (typeof count === 'number') { |
26✔ |
| 19 |
count--; |
|
|
UNCOV
20
|
if (count) {
|
× |
|
NEW
|
weakMap.set(target, count) |
× |
| 22 |
return false; |
26✔ |
|
|
} else {
|
26✔ |
|
|
weakMap.delete(target);
|
26✔ |
|
|
isOpen = false
|
26✔ |
|
|
return true; |
26✔ |
| 27 |
} |
26✔ |
| 28 |
} |
|
|
|
return false |
|
| 30 |
} |
1✔ |
| 31 |
|
|
|
|
export function bindTarget(target: object) {
|
26✔ |
|
|
if (count > 0) { |
26✔ |
|
|
weakMap.set(target, count); |
26✔ |
|
|
count = 0;
|
|
|
NEW
|
} else {
|
× |
|
NEW
|
console.warn(`The instance did not use the '@Setup' decorator`) |
× |
|
|
} |
|
| 39 |
} |