Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
- removes the need for directoryHash
- fixes bug with ci environment discovery that adds empty attributes
- updates dependencies
- updates the directoryHash function to work with different versions of node
- fixes cli issues (not setting MONGO_URL correctly)
- fixes issues with directoryHash functionality
- check for the version on the server and alert the user to upgrade if the versions are different
- fixes issue with git parsing all of the commit logs instead of the most recent
- moves mongo operations to mongoose
- uses express, simplifies server logic
- fixes issue where 0/0 is NaN
- make sure the git remotes are set correctly
- does not allow analytics to be pushed without having a git remote setup
- adds tests for node-coverage-cli
- fixes the routes for getting coverage data
  - 300576f
- updates main page to show current server version
- gets data from the environment variables to check for any services running
- be able to use node 4 for the node-coverage-cli
  - 93f35fb
- adds loading interstitial view for all coverage pages
- separates out some styles into style.css (coverage pages)
- truncates commit message if it is too large
- fixes the coverageFile page to show the correct percentage
- fixes the coverageFile page to show the correct point in history
- updates screenshots
- fixes routes to be more generic
- removes redundant code
- uses git-url-parse to format the urls before being sent to the service
- updates travis script
- updates readme to have badge that points to coverage service
- updates package.json to send coverage details to coverage service
- we don't need build dependencies
- remove support for node 4
- minor improvements
  - fixes coverage page using an incorrect interface for CoverageChart
  - fixes coverageFile page to have the same layout as the other coverage pages
    - updates screenshot
  - adds the error on the page to the error view in all coverage pages
  - uses the window location to generate the code snippet on the main page
    - updates screenshots
- captures ci information
- updates main page to show the correct way to get tap coverage
- updates routes to accept ci data from cli
  • Loading branch information
gabrielcsapo committed Sep 13, 2017
1 parent c1c26f9 commit 840854a
Show file tree
Hide file tree
Showing 68 changed files with 2,506 additions and 2,136 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
node_modules
.DS_Store
npm-debug.log
package-lock.json
3 changes: 1 addition & 2 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import '@kadira/storybook/addons';
import '@kadira/storybook-addon-knobs/register'
import '@storybook/addon-knobs/register'
2 changes: 1 addition & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configure } from '@kadira/storybook';
import { configure } from '@storybook/react';

function loadStories() {
require('../stories');
Expand Down
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
module: {
loaders: [{
rules: [{
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
},
Expand Down
30 changes: 6 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
# 0.2.4 (05/02/2017)
# 0.0.1

- removes the need for directoryHash
- fixes bug with ci environment discovery that adds empty attributes
- updates dependencies
- updates the directoryHash function to work with different versions of node

# 0.2.3 (05/02/2017)

- fixes cli issues (not setting MONGO_URL correctly)
- fixes issues with directoryHash functionality

# 0.2.2 (05/02/2017)

- check for the version on the server and alert the user to upgrade if the versions are different

# 0.2.1 (04/24/2017)

- fixes issue with git parsing all of the commit logs instead of the most recent

# 0.2.0 (04/17/2017)

- moves mongo operations to mongoose
- uses express, simplifies server logic
- fixes issue where 0/0 is NaN
- make sure the git remotes are set correctly
- does not allow analytics to be pushed without having a git remote setup
- adds tests for node-coverage-cli

# 0.1.1 (03/13/2017)

- fixes the routes for getting coverage data
- https://github.com/gabrielcsapo/node-coverage-server/commit/300576ffe221006e1b97bfcd1c80912f33ebad5f
- https://github.com/gabrielcsapo/lcov-server/commit/300576ffe221006e1b97bfcd1c80912f33ebad5f
- updates main page to show current server version
- gets data from the environment variables to check for any services running
- be able to use node 4 for the node-coverage-cli
- https://github.com/gabrielcsapo/node-coverage-server/commit/93f35fb78736ed9abdb9da736fb91be721cb435b

# 0.1.0 (03/09/2017)

- https://github.com/gabrielcsapo/lcov-server/commit/93f35fb78736ed9abdb9da736fb91be721cb435b
- adds loading interstitial view for all coverage pages
- separates out some styles into style.css (coverage pages)
- truncates commit message if it is too large
Expand All @@ -44,9 +29,6 @@
- fixes routes to be more generic
- removes redundant code
- uses git-url-parse to format the urls before being sent to the service

# 0.0.2 (03/08/2017)

- updates travis script
- updates readme to have badge that points to coverage service
- updates package.json to send coverage details to coverage service
Expand Down
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
# node-coverage-server
# lcov-server

[![Npm Version](https://img.shields.io/npm/v/node-coverage-server.svg)](https://www.npmjs.com/package/node-coverage-server)
[![Build Status](https://travis-ci.org/gabrielcsapo/node-coverage-server.svg?branch=master)](https://travis-ci.org/gabrielcsapo/node-coverage-server)
[![Coverage Status](https://node-coverage-server.herokuapp.com/badge/github/gabrielcsapo/node-coverage-server.svg)](https://node-coverage-server.herokuapp.com/coverage/github/gabrielcsapo/node-coverage-server)
[![Dependency Status](https://david-dm.org/gabrielcsapo/node-coverage-server.svg)](https://david-dm.org/gabrielcsapo/node-coverage-server)
[![devDependency Status](https://david-dm.org/gabrielcsapo/node-coverage-server/dev-status.svg)](https://david-dm.org/gabrielcsapo/node-coverage-server#info=devDependencies)
[![npm](https://img.shields.io/npm/dt/node-coverage-server.svg)]()
[![npm](https://img.shields.io/npm/dm/node-coverage-server.svg)]()
> 🎯 A simple lcov server & cli parser
[![Npm Version](https://img.shields.io/npm/v/lcov-server.svg)](https://www.npmjs.com/package/lcov-server)
[![Build Status](https://travis-ci.org/gabrielcsapo/lcov-server.svg?branch=master)](https://travis-ci.org/gabrielcsapo/lcov-server)
[![Coverage Status](https://lcov-server.herokuapp.com/badge/github/gabrielcsapo/lcov-server.svg)](https://lcov-server.herokuapp.com/coverage/github/gabrielcsapo/lcov-server)
[![Dependency Status](https://david-dm.org/gabrielcsapo/lcov-server.svg)](https://david-dm.org/gabrielcsapo/lcov-server)
[![devDependency Status](https://david-dm.org/gabrielcsapo/lcov-server/dev-status.svg)](https://david-dm.org/gabrielcsapo/lcov-server#info=devDependencies)
[![npm](https://img.shields.io/npm/dt/lcov-server.svg)]()
[![npm](https://img.shields.io/npm/dm/lcov-server.svg)]()

# What is this?

It is a lcov server! It stores lcov reports and categorizes them based on their origin repo.

![main screenshot](./screenshots/main.png)
# Prerequisites

- `mongodb` installed
- `nodejs` installed

# Install

```
npm install node-coverage-server -g
npm install lcov-server -g
```

# Usage

> cli
```
tap test --coverage-report=text-lcov | node-coverage-cli
tap test --coverage-report=text-lcov | lcov-server-cli
```

> cli:help
```
Usage: node-coverage-cli [options]
Usage: lcov-server-cli [options]
Options:
Expand All @@ -43,16 +48,17 @@ Options:
> server
```
Usage: node-coverage-server [options]
lcov-server
```

> server:help
```
Usage: lcov-server [options]
Options:
-h, --help output usage information
-V, --version output the version number
-d, --db Set the db connection
```

# Prerequisites

- mongodb installed
- nodejs installed
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [ ] show a pie chart of code types for a specific repo
- [ ] add more storybook stories for the UI
- [ ] jsdoc lib code
- [ ] abstract coverage model into a class
102 changes: 102 additions & 0 deletions bin/lcov-server-cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env node
'use strict';

const program = require('commander');
const http = require('http');
const https = require('https');
const fs = require('fs');
const url = require('url');
const updateNotifier = require('update-notifier');

const lcov = require('../lib/lcov');
const git = require('../lib/git');
const ci = require('../lib/ci');

const pkg = require('../package.json');

updateNotifier({pkg}).notify();

program
.version(pkg.version)
.option('-u, --url [db]', 'Set the url to upload lcov data too', 'http://localhost:8080')
.parse(process.argv);

const parsedUrl = url.parse(program.url);

let input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', (chunk) => {
input += chunk;
});
process.stdin.on('end', () => {
const env = ci();
const output = {
service_job_id: env.service_job_id,
service_pull_request: env.service_pull_request,
service_name: env.service_name,
source_files: [],
git: {
git_commit: env.git_commit,
git_branch: env.git_branch,
git_committer_name: env.git_committer_name,
git_committer_email: env.git_committer_email,
git_message: env.git_message
},
run_at: new Date()
};

lcov.parse(input)
.then((_lcov) => {
// Go through and set the file contents
for (let i = 0; i < _lcov.length; i++) {
_lcov[i].source = fs.readFileSync(_lcov[i].file).toString('utf8');
_lcov[i].title = _lcov[i].file.substring(_lcov[i].file.lastIndexOf('/') + 1, _lcov[i].file.length);
}
output['source_files'] = _lcov;

git.parse()
.then(function(_git) {
output['git'] = Object.assign(output['git'], _git);

const options = {
hostname: parsedUrl.hostname,
port: parsedUrl.port || 80,
path: '/api/v1/upload',
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
let req, operation, data = '';
if(parsedUrl.protocol == 'https') {
operation = https;
} else {
operation = http;
}
req = operation.request(options, (res) => {
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const response = JSON.parse(data);
if(response.error) {
console.error(response.error); // eslint-disable-line
} else {
console.log(`\n coverage sent successfully 💚 \n`); // eslint-disable-line
}
} catch(ex) {
console.log(`\n uhoh something went wrong, ${ex.toString()}`); // eslint-disable-line
}
});
});
req.write(JSON.stringify(output));
req.end();
})
.catch((err) => {
console.log(err); // eslint-disable-line
});
})
.catch((err) => { throw err; } );
});
17 changes: 17 additions & 0 deletions bin/lcov-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

const program = require('commander');
const updateNotifier = require('update-notifier');

const pkg = require('../package.json');

updateNotifier({pkg}).notify();

program
.version(pkg.version)
.option('-d, --db [db]', 'Set the db connection', 'mongodb://localhost:32768/lcov-server')
.parse(process.argv);

process.env.MONGO_URL = process.env.MONGO_URL || program.db;

require('../index');
102 changes: 0 additions & 102 deletions bin/node-coverage-cli.js

This file was deleted.

Loading

0 comments on commit 840854a

Please sign in to comment.