coveralls-api

1.2.4 • Public • Published

coveralls-api

npm typescript Coverage Status GitHub stars Twitter Follow

API client for coveralls.io.

To use coveralls-api, you will need a personal token. Personal tokens can be created on the Coveralls account page.

Full documentation:

Installation

yarn add coveralls-api
npm install coveralls-api

API

Create Repo

Usage

import Coveralls from "coveralls-api";
 
const coveralls = new Coveralls(token);
 
coveralls.createRepo({
  service: "github",
  name: "my-repo-name"
}).then((response) => {
  // ...
});

Types

function createRepo(args: CreateRepoArgs): Promise<CreateRepoResponse | undefined>;
 
type CreateRepoArgs = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
}
 
type CreateRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
}
 
type Service = "github" | "bitbucket" | "gitlab" | "stash" | "manual";

Get Repo

Usage

import Coveralls from "coveralls-api";
 
const coveralls = new Coveralls(token);
 
coveralls.getRepo("github", "my-github-user", "my-repo-name").then((response) => {
  // ...
});

Types

function updateRepo(
  service: Service,
  user: string,
  name: string
): Promise<GetRepoReponse | undefined>
 
type GetRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
  id: number;
  has_badge: boolean;
  token?: string;
}

Update Repo

Usage

import Coveralls from "coveralls-api";
 
const coveralls = new Coveralls(token);
 
coveralls.updateRepo("github", "my-github-user", "my-repo-name", {
  comment_on_pull_requests: true,
  send_build_status: false
}).then((response) => {
  // ...
});

Types

function updateRepo(
  service: Service,
  user: string,
  name: string,
  args: UpdateRepoArgs
): Promise<UpdateRepoReponse | undefined>
 
type UpdateRepoArgs = {
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
}
 
type UpdateRepoResponse = {
  service: Service;
  name: string;
  comment_on_pull_requests?: boolean;
  send_build_status?: boolean;
  commit_status_fail_threshold?: number | null;
  commit_status_fail_change_threshold?: number | null;
  created_at: string;
  updated_at: string;
}

Post Job

Usage

import Coveralls from "coveralls-api";
 
const coveralls = new Coveralls(token);
 
// From LCOV file:
coveralls.postJob("github", "my-github-user", "my-repo-name", {
  lcov_path: "coverage/lcov.info"
}).then((response) => {
  // ...
});
 
// From source files:
coveralls.postJob("github", "my-github-user", "my-repo-name", {
  source_files: [{
    name: ...
  }, ...]
}).then((response) => {
  // ...
});

Types

function postJob(service: Service, user: string, name: string, args: PostJobArgs | PostJobFromLCOVArgs): Promise<PostJobResponse>;
 
export type PostJobFromLCOVArgs = {
  lcov_path: string;
} & BaseJobArgs;
 
export type PostJobArgs = {
  source_files: SourceFile[];
} & BaseJobArgs;
 
export type SourceFile = {
  name: string;
  source_digest: string;
  coverage: (number | null)[];
  branches?: number[];
  source?: string;
}
 
type BaseJobArgs = {
  service_name?: string;
  service_number?: string;
  service_job_id?: string;
  service_pull_request?: string;
  parallel?: boolean;
  flag_name?: string;
  git?: {
    head?: {
      id?: string;
      committer_name?: string;
      committer_email?: string;
      message?: string;
      author_name?: string;
      author_email?: string;
    };
    branch?: string;
    remotes?: {
      name?: string;
      url?: string;
    }[];
  };
  commit_sha?: string;
  run_at?: Date | string;
}

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT

Package Sidebar

Install

npm i coveralls-api

Weekly Downloads

17

Version

1.2.4

License

MIT

Unpacked Size

31 kB

Total Files

13

Last publish

Collaborators

  • bconnorwhite