-
Notifications
You must be signed in to change notification settings - Fork 16
/
v8_coverage.format.txt
66 lines (48 loc) · 4.32 KB
/
v8_coverage.format.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
V8_COVERAGE
GOAL ==> #Code instrumentation to produce coverage.
#Done on V8 bytecode.
MODES ==> #Either:
# - "precise coverage": slow
# - "best efforts coverage": faster but imprecise (can lose information if function is
# out-of-scope and garbage collected)
DETAILS ==> #Includes:
# - function and branch hits, but not line hits (this is fixed by v8_to_istanbul though)
# - branches that were not hit
# - internal Node.js code
# - child processes, but not worker threads
/=+===============================+=\
/ : : \
)==: FORMAT :==(
\ :_______________________________: /
\=+===============================+=/
COVERAGE #Content of the coverage file, as JSON
COVERAGE.result #FILECOV_ARR, ordered by load start
FILECOV #Coverage of a special file
FILECOV.scriptId #Unique ID, incrementing 'INT'
FILECOV.url #'URL' (including file://)
FILECOV.functions #FUNCCOV_ARR
FUNCCOV #Coverage of a specific function
FUNCCOV.functionName #FUNC.name
#Can be '', including for top-level scope
FUNCCOV.ranges #BRANCHCOV_ARR
FUNCCOV.isBlockCoverage #BOOL. If false, branch covers the whole function, i.e. FUNCCOV.ranges === 1
#Note that on the other hand, sometimes FUNCCOV.ranges === 1 but FUNCCOV.isBlockCoverage === true
BRANCHCOV #Coverage of a specific branch
BRANCHCOV.startOffset|endOffset #Bytes offset inside the file
BRANCHCOV.count #NUM of times it was hit. Can be 0
/=+===============================+=\
/ : : \
)==: INSTRUMENTATION :==(
\ :_______________________________: /
\=+===============================+=/
INSPECTOR PROTOCOL ==> #Must use inspector protocol to do it.
ENVVAR NODE_V8_COVERAGE=DIR #Record "precise coverage" information and save to DIR/coverage-PID-TIMESTAMP.json
12*#That JSON file contains source maps if any
#Works with child processes
#Does it by using the inspector protocol under the hood
#For Node.js only.
V8.takeCoverage() 12.22.0*#Write the coverage JSON file and resets coverage information
12.22.0*#Done automatically on exit
V8.stopCoverage() 12.22.0*#