API Reference


Objects

Job

Description

A hash representing the coverage data from a single run of a test suite.

You must specify either repo_token or a service name and job id.

Arguments

repo_token
String
Required

The secret token for your repository, found at the bottom of your repository's page on Coveralls.

service_name
String
Required

The CI service or other environment in which the test suite was run. This can be anything, but certain services have special features (travis-ci, travis-pro, or coveralls-ruby).

service_job_id
String
Optional

A unique identifier of the job on the service specified by service_name.

source_files
Array
Required

An array of source files, including their coverage data.

git
Hash
Optional

A hash of Git data that can be used to display more information to users.

"git": {
  "head": {
    "id": "b31f08d07ae564b08237e5a336e478b24ccc4a65",
    "author_name": "Nick Merwin",
    "author_email": "...",
    "committer_name": "Nick Merwin",
    "committer_email": "...",
    "message": "version bump"
  },
  "branch": "master",
  "remotes": [
    {
      "name": "origin",
      "url": "[email protected]:lemurheavy/coveralls-ruby.git"
    }
  ]
},      
run_at
Timestamp
Optional

A timestamp of when the job ran. Must be parsable by Ruby.

"run_at": "2013-02-18 00:52:48 -0800"

Source File

Description

A hash representing a source code file and its coverage data for a single job.

Arguments

name
String
Required

Represents the file path of this source file. Must be unique in the job. Can include slashes. The file type for syntax highlighting will be determined from the file extension in this parameter.

source
String
Required

The full source code of this file. Newlines should use UNIX-style line endings (\n).

coverage
Array
Required

The coverage data for this file for the file's job.

The item at index 0 represents the coverage for line 1 of the source code.

Acceptable values in the array:

  • A positive integer if the line is covered, representing the number of times the line is hit during the test suite.
  • 0 if the line is not covered by the test suite.
  • null to indicate the line is not relevant to code coverage (it may be whitespace or a comment).
[null, 1, 0, null, 4, 15, null]