GithubHelp home page GithubHelp logo

isabella232 / coverage-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from badoo/coverage-service

0.0 0.0 0.0 314 KB

Create code coverage report from window.__coverage__ object

JavaScript 97.91% HTML 2.09%

coverage-service's Introduction

Coverage service

Create coverage report from window.__coverage__ object

Coverage Status

API

Get info

Get info from currently uploaded coverage objects.

URL: /api/info

Method: GET

Success response:

Code: 200

[
  {
    "no": 1,
    "version": "6.42.0",
    "type": "dist",
    "gitHash": "35df47ca4e100ad5ce8d1ef25cb7a9ee5482",
    "sessionCnt": 12,
    "size": 44409338,
    "sizeDisplay": "42.4 MB",
    "updated": "2017-12-05T18:51:05.000Z"
  }
]

Example call:

curl -X GET http://localhost:9000/api/info

Get progress info

Get more details about code coverage and difference between versions.

URL: /api/info/progress

Method: GET

Success response:

Code: 200

[
  {
    "gitHash": "35df47ca4e100ad5ce8d1ef25cb7a9ee5482",
    "Stmts": {
      "value": 47.74,
      "diff": 1.7
    },
    "Branch": {
      "value": 32.26,
      "diff": 2.76
    },
    "Funcs": {
      "value": 38.62,
      "diff": 0.14
    },
    "Lines": {
      "value": 48.22,
      "diff": 1.52
    }
  }
]

Example call:

curl -X GET http://localhost:9000/api/info/progress

Post version object

Post version.json object as payload, to report new version.

URL: /api/version

Method: POST

Payload data: version.json object

Success response:

Code: 200

{
  "build": 1512130791063,
  "version": "6.42.0",
  "type": "dist",
  "desc": "Production Build",
  "gitHash": "35df47ca4e100ad5ce8d1ef25cb7a9ee5482"
}

Example call:

POST content of version.json file:

curl -X POST http://localhost:9000/api/version -d @version.json --header "Content-Type: application/json"

Coverage

Post coverage object

Post window.__coverage__ object as payload. Subsequent requests append to already saved coverage.

URL: /api/coverage/:hash

Method: POST

Payload data: window.__coverage__ object

Success response:

Code: 200

{
  "content-length": 10485760
}

Error response:

Code: 500

Error: Something went wrong

Example call:

curl -X POST http://localhost:9000/api/coverage/1fbd5f2220ef -d @coverage.json --header "Content-Type: application/json"

Get coverage report (plain text)

From currently uploaded coverage objects.

URL: /api/coverage/:hash

Method: GET

Success response:

Code: 200

--------------------------|----------|----------|----------|----------|----------------|
File                      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------------|----------|----------|----------|----------|----------------|
All files                 |    46.98 |    29.31 |    37.94 |    45.96 |                |
...                       |          |          |          |          |                |

Error response:

Code: 404

Coverage object not found

Code: 500

Error generating report

Example call:

curl -X GET http://localhost:9000/api/coverage/1fbd5f2220ef

Generate coverage report (HTML)

Generate a HTML report. Checkout git repository at specific commit in the process.

URL: /api/coverage/html/:hash

Method: GET

Success response:

Code: 200

/html/35df47ca4e100ad5ce8d1ef25cb7a9ee5482

HTML report is visible at http://localhost:9000/html/35df47ca4e100ad5ce8d1ef25cb7a9ee5482

Example call:

curl -X GET http://localhost:9000/api/coverage/html/1fbd5f2220ef

Git

Clone git repository

Slow. Needed to generate HTML report. It might take several minutes, depending on repo size.

URL: /api/git

Method: POST

Success response:

Code: 200

Cloning into 'repo'...
remote: Counting objects: 649650, done.
remote: Compressing objects: 100% (294425/294425), done.
...

Error response:

Code: 409

Repository already exists

Example call:

curl -X POST http://localhost:9000/api/git

Clear cloned repository

URL: /api/git

Method: DELETE

Success response:

Code: 200

OK

Error response:

Code: 404

Repository not found

Example call:

curl -X DELETE http://localhost:9000/api/git

Setup

npm install

Run

npm run start

Environment variables

PORT

(Number)

HTTP port number to use. Default: 9000

PAYLOAD_LIMIT

(String)

Maximum payload size allowed. Default: 50MB

REPO

(String)

Git remote repository. Default: [email protected]:repo.git

REPO_BRANCH

(String)

Git repository branch. Default: master

DATA_DIR

(String)

Location on disk where to store temporary working data (checked-out repository, coverage objects, and generated HTML reports). Default: __dirname/data

coverage-service's People

Contributors

miloss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.