@form8ion/codecov

code coverage service plugin for form8ion

Usage no npm install needed!

<script type="module">
  import form8ionCodecov from 'https://cdn.skypack.dev/@form8ion/codecov';
</script>

README

codecov

code coverage service plugin for form8ion

Node CI Workflow Status Codecov

Table of Contents

Features

Scaffold

  • Define a coverage status badge to communicate current coverage details
  • Link from the status badge to further details on the Codecov site
  • Define a coverage status badge for private projects when an apiAccessToken string (optional) is provided

Lift

Usage

MIT license npm Try @form8ion/codecov on RunKit

Installation

$ npm install @form8ion/codecov --save

Example

Import

import {packageManagers} from '@form8ion/javascript-core';
import {scaffold, lift} from '@form8ion/codecov';

Execute

(async () => {
  await scaffold({
    visibility: 'Public',
    vcs: {
      host: 'github',
      owner: 'foo',
      name: 'bar'
    }
  });

  await scaffold({
    visibility: 'Private',
    vcs: {
      host: 'github',
      owner: 'foo',
      name: 'bar'
    },
    apiAccessToken: 'XXXXXX'
  });

  await lift({projectRoot: process.cwd(), packageManager: packageManagers.NPM});
})();

API

scaffold

Scaffolder for configuring reporting of coverage data to Codecov and providing visibility to the current coverage status through a README badge

Takes a single options object as an argument, containing:

vcs object (required)
  • host string (required) VCS hosting service
  • owner string (required) account name on the host service for the repository
  • name string (required) repository name
visibility string (required)

Visibility of the project (Public or Private). Unless apiAccessToken is provided, Codecov details will only be scaffolded for public projects.

apiAccessToken string (optional)

Personal Access Token for accessing the Codecov API. Providing an access token enables fetching the image_token for the repository so that the coverage badge can display the proper coverage state of the project when the project is not public. Since the Codecov API appears to only support GitHub at the time of this implementation, GitHub is the only VCS host supported by this scaffolder at this time.

lift

Migrates Codecov details from legacy conventions to modern conventions.

Takes a single options object as an argument, containing:

projectRoot string (required)

path to the root of the project

packageManager string (required)

chosen package manager to be used for the project

Contributing

PRs Welcome Commitizen friendly Conventional Commits semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test