2017-10-12 21 views
1

Je veux convertir istanbul fichier de rapport de couverture récupéré du client au format JSON au format html. Actuellement j'utilise remap-istanbul pour cela mais en fait cet outil particulier particulier est conçu pour remapper les données de couverture pour le code qui a été écrit à l'origine dans différentes langues (comme tapuscrit).Comment convertir le fichier istanbul json existant en html

donc je suppose que s'il y a moyen de faire plus pratique le même

Répondre

0

Utilisez istanbul report html pour convertir les données de couverture existantes de JSON en HTML:

istanbul report html 

Par défaut, les regards ci-dessus dans le courant répertoire (et ses sous-répertoires) pour tout fichier commençant par "coverage" et se terminant par ".json", et affiche les rapports HTML dans le répertoire ./coverage/.

Pour convertir un fichier spécifique dans un répertoire spécifique:

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

Une autre façon de lire que des rapports de couverture d'un répertoire spécifique (par exemple tous les fichiers JSON dans path/to) est la suivante, en utilisant l'option --root :

istanbul report --root path/to --include=*.json --dir my-coverage-dir html 

Utilisez istanbul help report pour plus d'options (ce qui suit est généré avec istanbul 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. 

La valeur --input est un motif glob. Pour plus de documentation sur les modèles de glob, voir le documentation at the glob package on NPM.