• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fmfe / vue-class-setup / #219

19 Jul 2024 06:35AM UTC coverage: 97.542% (-0.7%) from 98.278%
#219

push

travis-pro

lzxb
fix: 修复未使用 @Setup 装饰器导致内存泄漏的BUG

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

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/src/setup-reference.ts
1

1✔
2
let count = 0;
1✔
3
let isOpen = false;
1✔
4

1✔
5
export function add () {
33✔
6
    if (isOpen) {
9✔
7
        count = 1;
28✔
8
    } else {
24✔
9
        isOpen = true;
24✔
10
        count++;
24✔
11
    }
33✔
12
}
1✔
13

1✔
14
const weakMap = new WeakMap<object, number>();
1✔
15

1✔
16
export function popTarget(target: object): boolean {
33✔
17
    let count = weakMap.get(target);
33✔
18
    if (typeof count === 'number') {
26✔
19
        count--;
26!
UNCOV
20
        if (count) {
×
NEW
21
            weakMap.set(target, count)
×
22
            return false;
26✔
23
        } else {
26✔
24
            weakMap.delete(target);
26✔
25
            isOpen = false
26✔
26
            return true;
26✔
27
        }
26✔
28
    }
33✔
29
    return false
33✔
30
}
1✔
31

1✔
32
export function bindTarget(target: object) {
26✔
33
    if (count > 0) {
26✔
34
        weakMap.set(target, count);
26✔
35
        count = 0;
26!
NEW
36
    } else {
×
NEW
37
        console.warn(`The instance did not use the '@Setup' decorator`)
×
38
    }
26✔
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc