Coverage cleanup (#2328)

- Stop running daily service tests in the main repo (since they're now handled [over here](https://github.com/badges/daily-tests)
- Add coverage and separate daily tests badges with links to coveralls
- Update our coverage ignores
    - Move scripts, which do not need coverage, into `scripts/`
- Split out coverage test for npm package
- Remove spurious env var

Ref: #1584 #2314
This commit is contained in:
Paul Melnikow
2018-11-17 09:37:09 -05:00
committed by GitHub
parent 547380f794
commit ff9cd20821
8 changed files with 21 additions and 31 deletions

View File

@@ -0,0 +1,11 @@
#!/bin/sh
PROFILE_MAKE_BADGE=1 node server 1111 >perftest.log &
sleep 2
for ((i=0;i<10000;i++)); do
curl -s http://localhost:1111/badge/coverage-"$i"%-green.svg >/dev/null
done
kill $(jobs -p)
<perftest.log grep 'makeBadge total' | \
grep -Eo '[0-9\.]+' | \
awk '{s+=$1;n++} END {print s/n}'

View File

@@ -0,0 +1,5 @@
'use strict'
const allBadgeExamples = require('../lib/all-badge-examples')
process.stdout.write(JSON.stringify(allBadgeExamples))

View File

@@ -0,0 +1,21 @@
'use strict'
const path = require('path')
const glob = require('glob')
const supportedFeatures = {
logos: glob
.sync(`${__dirname}/../logo/*.svg`)
.map(filename => path.basename(filename, '.svg')),
advertisedStyles: [
'plastic',
'flat',
'flat-square',
'for-the-badge',
'popout',
'popout-square',
'social',
],
}
console.log(JSON.stringify(supportedFeatures, null, 2))

View File

@@ -0,0 +1,22 @@
'use strict'
const chalk = require('chalk')
const mapValues = require('lodash.mapvalues')
const colorscheme = require('../gh-badges/lib/colorscheme.json')
const colorsMap = mapValues(colorscheme, 'colorB')
const { floorCount } = require('../lib/color-formatters')
const { loadServiceClasses } = require('../services')
const serviceClasses = loadServiceClasses()
const legacyServices = serviceClasses
.map(cls => (typeof cls.registerLegacyRouteHandler === 'function' ? 1 : 0))
.reduce((a, b) => a + b)
const newServices = serviceClasses.length - legacyServices
const percentDone = ((newServices / serviceClasses.length) * 100).toFixed(2)
const color = floorCount(percentDone, 10, 50, 100)
console.log(`Found ${serviceClasses.length} services:`)
console.log(`- ${legacyServices} legacy services`)
console.log(`- ${newServices} new services`)
console.log(chalk.hex(colorsMap[color])(`${percentDone}% done`))