版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # v8-to-istanbul
  2. [![Build Status](https://travis-ci.org/istanbuljs/v8-to-istanbul.svg?branch=master)](https://travis-ci.org/istanbuljs/v8-to-istanbul)
  3. [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
  4. ![nycrc config on GitHub](https://img.shields.io/nycrc/istanbuljs/v8-to-istanbul)
  5. converts from v8 coverage format to [istanbul's coverage format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md).
  6. ## Usage
  7. ```js
  8. const v8toIstanbul = require('v8-to-istanbul')
  9. // the path to the original source-file is required, as its contents are
  10. // used during the conversion algorithm.
  11. const converter = v8toIstanbul('./path-to-instrumented-file.js')
  12. await converter.load() // this is required due to async file reading.
  13. // provide an array of coverage information in v8 format.
  14. converter.applyCoverage([
  15. {
  16. "functionName": "",
  17. "ranges": [
  18. {
  19. "startOffset": 0,
  20. "endOffset": 520,
  21. "count": 1
  22. }
  23. ],
  24. "isBlockCoverage": true
  25. },
  26. // ...
  27. ])
  28. // output coverage information in a form that can
  29. // be consumed by Istanbul.
  30. console.info(JSON.stringify(converter.toIstanbul()))
  31. ```
  32. ## Ignoring Uncovered Lines
  33. Sometimes you might find yourself wanting to ignore uncovered lines
  34. in your application (for example, perhaps you run your tests in Linux, but
  35. there's code that only executes on Windows).
  36. To ignore lines, use the special comment `/* c8 ignore next */`.
  37. ### ignoring the next line
  38. ```js
  39. const myVariable = 99
  40. /* c8 ignore next */
  41. if (process.platform === 'win32') console.info('hello world')
  42. ```
  43. ### ignoring the next N lines
  44. ```js
  45. const myVariable = 99
  46. /* c8 ignore next 3 */
  47. if (process.platform === 'win32') {
  48. console.info('hello world')
  49. }
  50. ```
  51. ### ignoring all lines until told
  52. ```js
  53. /* c8 ignore start */
  54. function dontMindMe() {
  55. // ...
  56. }
  57. /* c8 ignore stop */
  58. ```
  59. ### ignoring the same line as the comment
  60. ```js
  61. const myVariable = 99
  62. const os = process.platform === 'darwin' ? 'OSXy' /* c8 ignore next */ : 'Windowsy'
  63. ```
  64. ## Testing
  65. To execute tests, simply run:
  66. ```bash
  67. npm test
  68. ```