2017-10-12 17 views
1

클라이언트에서 JSON 형식으로 가져온 istanbul 적용 범위 보고서 파일을 html 형식으로 변환하고 싶습니다. 현재 나는 remap-istanbul을 사용하고 있지만 실제로 특정 도구는 원래 다른 언어 (타이프 스크립트)로 작성된 코드의 적용 범위 데이터를 다시 매핑하도록 설계되었습니다. 현재의기존 istanbul json 파일을 html로 변환하는 방법

기본적으로
istanbul report html 

, 위의 모습을 :

그래서 나는 HTML로 JSON에서 기존 커버리지 데이터를 변환하기 위해 동일한

답변

0

사용 istanbul report html을 할 수있는 편리한 방법이 있는지 생각 "coverage"로 시작하고 ".json"으로 끝나는 모든 파일에 대한 디렉토리 (및 하위 디렉토리)를 지정하고 HTML 보고서를 ./coverage/ 디렉토리로 출력합니다.

특정 디렉토리에 특정 파일을 변환하려면 다음과 --root 옵션을 사용하여 다음과 같이

istanbul report --include path/to/my-coverage-file.json --dir my-coverage-dir html 

만 특정 디렉토리에서 커버리지 리포트를 읽을 수있는 또 다른 방법 (예를 들어 path/to의 모든 JSON 파일)입니다 : 더 많은 옵션을 볼 수

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 패턴입니다. glob 패턴에 대한 자세한 내용은 documentation at the glob package on NPM을 참조하십시오.