# Coverage

#### new Coverage()

Source:
  - coverage.js, line 3

##### Properties:

Name | Type | Description
--- | --- | ---
`run_at` | string | the iso date when the coverage was send to the server
`source_files` | Array.<Object> | a list of all the source files related to the coverage report
`source_files[].name` | string | the name of the file parsed
`source_files[].source` | string | the content of the file parsed into a string
`source_files[].coverage` | Array.<Object> | an array of objects describing the state of the parsed file
`source_files[].coverage[].lines` | object | an object descibing the lines covered in the file ###### Properties
Name | Type | Description
--- | --- | ---
`found` | number | total number of lines found in the file
`hits` | number | total number of lines covered in the file
`details` | Array.<Object> | an array of points in the file that descibes the line and the amount of times it was covered ###### Properties
Name | Type | Description
--- | --- | ---
`line` | number | the line number that is covered
`hit` | number | how many times the line was hit
`source_files[].coverage[].functions` | object | an object descibing the functions covered in the file ###### Properties
Name | Type | Description
--- | --- | ---
`found` | number | total number of functions found in the file
`hits` | number | total number of functions covered in the file
`details` | Array.<Object> | an array of points in the file that descibes the line and the amount of times it was covered ###### Properties
Name | Type | Description
--- | --- | ---
`line` | number | the line number that is covered
`hit` | number | how many times the line was hit
`source_files[].coverage[].branches` | object | an object descibing the branches covered in the file ###### Properties
Name | Type | Description
--- | --- | ---
`found` | number | total number of branches found in the file
`hits` | number | total number of branches covered in the file
`details` | Array.<Object> | an array of points in the file that descibes the line and the amount of times it was covered ###### Properties
Name | Type | Description
--- | --- | ---
`line` | number | the line number that is covered
`hit` | number | how many times the line was hit
`git` | object | the state of the git config at the time of sending coverage ###### Properties
Name | Type | Description
--- | --- | ---
`head` | object | git head details ###### Properties
Name | Type | Description
--- | --- | ---
`id` | string | the commit id
`committer_name` | string | the committer name
`committer_email` | string | the committer email
`message` | string | the commit message
`author_name` | string | the author of the commit's name
`author_email` | string | the author of the commit's email
`branch` | string | the current working branch
`remotes` | Array.<Object> | an array of all the remotes
`remotes[].name` | string | the name of the remote
`remotes[].url` | string | the url of the remote

##### Example

    {
      "source_files": [{
          "name": "util/lcov.js",
          "source": "function d() {\n  return \'hello\';\n}",
          "coverage": [{
              "lines": {
                  "found": 53,
                  "hit": 53,
                  "details": [{
                      "line": 1,
                      "hit": 1
                  }, {...}]
              },
              "functions": {
                  "hit": 6,
                  "found": 6,
                  "details": [{
                      "name": "(anonymous_0)",
                      "line": 7,
                      "hit": 3
                  }, {...}]
              },
              "branches": {
                  "hit": 24,
                  "found": 24,
                  "details": [{
                      "line": 16,
                      "block": 0,
                      "branch": 0,
                      "taken": 4
                  }, {...}]
              },
              "title": "",
              "source": "",
              "file": "/Users/gacsapo/Documents/temp/node-coverage-server/util/lcov.js"
          }]
      }],
      "git": {
          "head": {
              "id": "07e4ee9f38d7c41fed09a2b93f6ce23c4a2c49da",
              "committer_name": "Gabriel Csapo",
              "committer_email": "gabecsapo@gmail.com",
              "message": "Initial commit",
              "author_name": "Gabriel Csapo",
              "author_email": "gabecsapo@gmail.com"
          },
          "branch": "master",
          "remotes": [{
              "name": "origin",
              "url": "https://github.com/gabrielcsapo/node-coverage-server.git"
          }]
      },
      "run_at": "2017-01-17T23:18:16.248Z"
    }

### Methods

#### (static) get(repo) → {Array.<Coverage>}

Source:
  - coverage.js, line 151

gets a repos coverage model or all coverage models

##### Parameters:

Name | Type | Description
--- | --- | ---
`repo` | string | the url of the repo

##### Returns:

- a promise that resolves with the model after it was inserted

Type
  Array.<Coverage>

#### (static) repos(repo) → {Promise}

Source:
  - coverage.js, line 123

gets a list of repos

##### Parameters:

Name | Type | Description
--- | --- | ---
`repo` | string | the url of the repo

##### Returns:

- a promise that resolves with the model after it was inserted

Type
  Promise

#### (static) save(model) → {Promise}

Source:
  - coverage.js, line 101

saves a coverage model the collection

##### Parameters:

Name | Type | Description
--- | --- | ---
`model` | Coverage | the coverage model

##### Returns:

- a promise that resolves with the model after it was inserted

Type
  Promise