1
我想將istanbul
覆蓋率報告文件從JSON格式的客戶端轉換爲html格式。目前我使用的是remap-istanbul
,但實際上,特定的工具旨在重新映射原始用不同語言(如打字稿)編寫的代碼的覆蓋率數據。如何將現有的伊斯坦布爾json文件轉換爲html
所以我想是否有更便捷的方式做同樣的
我想將istanbul
覆蓋率報告文件從JSON格式的客戶端轉換爲html格式。目前我使用的是remap-istanbul
,但實際上,特定的工具旨在重新映射原始用不同語言(如打字稿)編寫的代碼的覆蓋率數據。如何將現有的伊斯坦布爾json文件轉換爲html
所以我想是否有更便捷的方式做同樣的
使用istanbul report html
現有的覆蓋數據從JSON轉換爲HTML:
istanbul report html
默認情況下,在當前上述外觀目錄(及其子目錄),以任何以「coverage」開頭並以「.json」結尾的文件,並將HTML報告輸出到./coverage/
目錄。
到特定文件轉換爲特定的目錄:
istanbul report --include path/to/my-coverage-file.json --dir my-coverage-dir html
另一種方式爲只讀從一個特定的目錄覆蓋報告(如path/to
所有JSON文件)如下,使用--root
選項:
istanbul report --root path/to --include=*.json --dir my-coverage-dir html
使用istanbul help report
看到更多選項(如下與伊斯坦布爾0.4.5生成):
Usage: istanbul report <options> [ <format> ... ]
Options are:
--config <path-to-config>
the configuration file to use, defaults to .istanbul.yml
--root <input-directory>
The input root directory for finding coverage files
--dir <report-directory>
The output directory where files will be written. This defaults
to ./coverage/
--include <glob>
The glob pattern to select one or more coverage files, defaults
to **/coverage*.json
--verbose, -v
verbose mode
<format> is one of
clover XML coverage report that can be consumed by the clover tool
cobertura
XML coverage report that can be consumed by the cobertura tool
html Navigable HTML coverage report for every file and directory
json prints the coverage object as JSON to a file
json-summary
prints a summary coverage object as JSON to a file
lcov combined lcovonly and html report that generates an lcov.info
file as well as HTML
lcovonly
lcov coverage report that can be consumed by the lcov tool
none Does nothing. Useful to override default behavior and suppress
reporting entirely
teamcity
report with system messages that can be interpreted with TeamCity
text text report that prints a coverage line for every file, typically
to console
text-lcov
lcov coverage report that can be consumed by the lcov tool
text-summary
text report that prints a coverage summary across all files,
typically to console
Default format is lcov unless otherwise specified in the config file. In
addition you can tweak the file names for various reports using the config
file. Type `istanbul help config` to see what can be tweaked.
--input
的值是一個glob模式。有關全局模式的更多文檔,請參閱documentation at the glob
package on NPM。