# screwdriver-coverage-base

> Base class defining the interface for coverage upload implementations

Latest version **4.0.0** (published 2025-02-20) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install screwdriver-coverage-base
pnpm add screwdriver-coverage-base
yarn add screwdriver-coverage-base
bun add screwdriver-coverage-base
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2025-02-20 |
| First published | 2018-05-04 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Min Zhang |
| Maintainers | screwdriver |
| Keywords | screwdriver, yahoo |

## Links

- npm: https://www.npmjs.com/package/screwdriver-coverage-base
- Repository: https://github.com/screwdriver-cd/coverage-base
- Issues: https://github.com/screwdriver-cd/screwdriver/issues
- npm.io page: https://npm.io/package/screwdriver-coverage-base

## Recent versions

- 4.0.0 (latest) — 2025-02-20
- 3.0.0 — 2022-11-28
- 2.1.0 — 2021-07-09
- 2.0.2 — 2020-12-03
- 2.0.1 — 2020-08-03
- 2.0.0 — 2020-07-28
- 1.0.8 — 2019-09-26
- 1.0.7 — 2018-12-20
- 1.0.6 — 2018-09-07
- 1.0.5 — 2018-05-09
- 1.0.4 — 2018-05-09
- 1.0.3 — 2018-05-08
- 1.0.2 — 2018-05-04
- 1.0.1 — 2018-05-04
- 1.0.0 — 2018-05-04

## README

# Coverage Base
[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]

> Base class defining the interface for coverage upload implementations

## Usage

```bash
npm install screwdriver-coverage-base
```

## Interface
This is an interface for uploading code coverage results from a Screwdriver build to a code coverage server.

### getAccessToken
##### Required Parameters
| Parameter        | Type  |  Description |
| :--------------- | :---- | :----------- |
| config           | Object |             |
| config.buildCredentials | Object | Information stored in the build JWT token |
| config.projectKey | String | Project key (can be directly passed in with just startTime and endTime) |
| config.scope | String | Coverage scope (pipeline or job) |
| config.username | String | Project username |

##### Expected Outcome
The `getAccessToken` function should resolve a Promise with an access token that build can use to talk to the code coverage server.

### getInfo
##### Required Parameters
| Parameter        | Type   |  Description |
| :--------------- | :----- | :----------- |
| config           | Object |              |
| config.jobId     | String | The unique ID for a job |
| config.jobName   | String | The Screwdriver job name |
| config.pipelineId | String | The unique ID for a pipeline |
| config.pipelineName | String | The Screwdriver pipeline name |
| config.prNum     | String | The pull request number |
| config.startTime | String | The job start time |
| config.endTime   | String | The job end time |
| config.projectKey | String | Project key (can be directly passed in with just startTime and endTime) |
| config.prParentJobId | String | PR parent job ID |
| config.scope | String | Coverage scope (pipeline or job) |

##### Expected Outcome
The `getInfo` function should resolve a Promise with an object with metadata about the project coverage.

### getUploadCoverageCmd
##### Required Parameters
| Parameter        | Type   |  Description |
| :--------------- | :----- | :----------- |
| config           | Object |              |
| config.build     | String | The build    |
| config.job       | String | The job      |
| config.pipeline  | String | The pipeline |

##### Expected Outcome
The `getUploadCoverageCmd` function should resolve a Promise with a string of shell commands to upload code coverage results.

## Extending
To extend the base class, the functions to override are:
1. `_getAccessToken`
1. `_getInfo`
1. `_getUploadCoverageCmd`


## Testing

```bash
npm test
```

## Related links
See the [coverage-bookend](https://github.com/screwdriver-cd/coverage-bookend)

## License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.

[npm-image]: https://img.shields.io/npm/v/screwdriver-coverage-base.svg
[npm-url]: https://npmjs.org/package/screwdriver-coverage-base
[downloads-image]: https://img.shields.io/npm/dt/screwdriver-coverage-base.svg
[license-image]: https://img.shields.io/npm/l/screwdriver-coverage-base.svg
[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/coverage-base.svg
[issues-url]: https://github.com/screwdriver-cd/coverage-base/issues
[status-image]: https://cd.screwdriver.cd/pipelines/705/badge
[status-url]: https://cd.screwdriver.cd/pipelines/705

---
_Source: https://npm.io/package/screwdriver-coverage-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
