-
Notifications
You must be signed in to change notification settings - Fork 16
/
c8.node.txt
99 lines (77 loc) · 5.59 KB
/
c8.node.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
C8
ALTERNATIVES ==> # - c8 (prefered): run it with NODE_V8_COVERAGE
# - eywek v8-coverage:
# - run it using INSPECTOR core module
# - does almost same otherwise
# - deno coverage (prefered with Deno): simple but misses some features
VERSION ==> #10.1.2
CONFIG ==> #Either:
# - CLI --OPT
# - PACKAGE.c8 OBJ
# - [.../].c8rc[.json]
/* v8 ignore start|stop [...] */ #Comment to disable
#Must use /* */ not //
/* v8 ignore next [NUM] [...] */ #Comment to disable next line|branch
c8 ... #Do:
# - create v8 coverage files by running Node with ENVVAR NODE_V8_COVERAGE
# - merge all v8 coverage files
# - convert to ISTANBUL_FILECOV (with V8-TO-ISTANBUL)
# - translate positions using source maps
# - convert to ISTANBUL_COVEMAP (with ISTANBUL-LIB-COVERAGE)
# - run reporters (with ISTANBUL-LIB-REPORT)
# - check coverage
CONF ==> #Can be:
# - [.../].c8rc|.nycrc[.json]
# - --config|-c 'JSON_FILE'
# - PACKAGE.c8 OBJ
# - CLI flags
#Case is dasherized in both JSON file and CLI flags
--reporter|r 'FORMAT'
--report[s]-dir|o 'DIR'
OPTS.reporterOptions OBJ
--exclude|x 'GLOB'
--include|n 'GLOB'
--exclude-node-modules
--exclude-after-remap
--extension|e '.EXT'
--extends 'PATH.json'
--skip-full
--all #Like nyc|Istanbul, including defaults
--src #Source directory. Can be several times. Def: current directory
--allow-external #Allow files outsides source directories (def: false)
--temp-directory PATH #Def: --report-dir
--[no-]clean #BOOL (def: true). Remove temp-directory after run.
--resolve DIR #Base directory for files
--[no-]omit-relative #Def: true
--check-coverage #Exit code 1 if fails. Does report too.
--branches|functions|lines|
statements NUM #
--100 #Same as --branches|functions|lines|statements 100
--per-file #Def: false
--merge-async #Process files more serially to reduce memory usage
--wrapper-length NUM #Size of header injected by either require() (62, def) or import() (0)
#Used to shift position offsets
--experimental-monocart #Use monocart-coverage-reports (must be installed)
ENVVAR EXPERIMENTAL_MONOCART=true #It is a different way to generate reports
c8 report #Same but without running and instrumenting Node.js first
c8 check-coverage #Report + check-coverage.
/=+===============================+=\
/ : : \
)==: V8-TO-ISTANBUL :==(
\ :_______________________________: /
\=+===============================+=/
VERSION ==> #9.2.0
#Convert V8 FILECOV file to Istanbul FILECOV
#Adds line-wise coverage (V8 otherwise is only branch-wise and file-wise)
V8-TO-ISTANBUL('./SOURCE_FILE.js' #NUM is --wrapper-length
[, NUM][, OPTS] #Apply source maps if available, either inline or external source map:
[, FUNC(PATH)->BOOL])->CSCRIPT #OPTS
# - source STR, originalSource STR, sourceMap.sourcemap SOURCEMAP: otherwise, use fs.readFileSync()
#FUNC(): if false, ignore file
CSCRIPT.load()->PROMISE #Must be done before applyCoverage()
CSCRIPT.applyCoverage(V8_FILECOV) #
CSCRIPT.toIstanbul()
->ISTANBUL_FILECOV #
CSCRIPT.destroy() #Removes WASM-related data