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

@@ -227,19 +227,6 @@ jobs:
echo 'This is not a pull request. Skipping.'
fi
services-daily:
docker:
- image: shieldsio/shields-ci-node-8:0.0.3
steps:
- checkout
- restore_cache:
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Run all service tests
command: npm run test:services
workflows:
version: 2
@@ -270,13 +257,3 @@ workflows:
filters:
branches:
ignore: /dependabot\/.*/
daily:
triggers:
- schedule:
cron: "0 17 * * *"
filters:
branches:
only: master
jobs:
- services-daily

View File

@@ -4,7 +4,10 @@
"exclude": [
"**/*.spec.js",
"**/*.integration.js",
"dangerfile.js",
"services/**/*.tester.js",
"test-fixtures",
"scripts",
"coverage",
"build"
],

View File

@@ -10,6 +10,12 @@
<a href="https://circleci.com/gh/badges/shields/tree/master">
<img src="https://img.shields.io/circleci/project/github/badges/shields/master.svg"
alt="build status"></a>
<a href="https://circleci.com/gh/badges/daily-tests">
<img src="https://img.shields.io/circleci/project/github/badges/daily-tests.svg?label=daily%20tests"
alt="daily build status"></a>
<a href="https://coveralls.io/github/badges/shields">
<img src="https://img.shields.io/coveralls/github/badges/shields.svg"
alt="coverage"></a>
<a href="https://github.com/badges/shields/compare/gh-pages...master">
<img src="https://img.shields.io/github/commits-since/badges/shields/gh-pages.svg?label=commits%20to%20be%20deployed"
alt="commits to be deployed"></a>
@@ -113,12 +119,15 @@ snapshots, and `SNAPSHOT_UPDATE=1 npm run test:js:server` to update them.
The server can be configured to use [Sentry][] ([configuration][sentry configuration]) and [Prometheus][] ([configuration][prometheus configuration]).
Daily tests, including a full run of the service tests and overall code coverage, are run via [badges/daily-tests][daily-tests].
[package manager]: https://nodejs.org/en/download/package-manager/
[snapshot tests]: https://glebbahmutov.com/blog/snapshot-testing/
[Prometheus]: https://prometheus.io/
[prometheus configuration]: doc/self-hosting.md#prometheus
[Sentry]: https://sentry.io/
[sentry configuration]: doc/self-hosting.md#sentry
[daily-tests]: https://github.com/badges/daily-tests
Hosting your own server
-----------------------

View File

@@ -58,11 +58,12 @@
"xpath": "~0.0.27"
},
"scripts": {
"coverage:test:server": "HANDLE_INTERNAL_ERRORS=false nyc node_modules/mocha/bin/_mocha \"*.spec.js\" \"lib/**/*.spec.js\" \"gh-badges/**/*.spec.js\" \"services/**/*.spec.js\"",
"coverage:test:frontend": "NODE_ENV=mocha nyc node_modules/mocha/bin/_mocha --require @babel/polyfill --require @babel/register \"frontend/**/*.spec.js\"",
"coverage:test:server": "HANDLE_INTERNAL_ERRORS=false nyc node_modules/mocha/bin/_mocha \"*.spec.js\" \"lib/**/*.spec.js\" \"services/**/*.spec.js\"",
"coverage:test:package": "nyc node_modules/mocha/bin/_mocha \"gh-badges/**/*.spec.js\"",
"coverage:test:integration": "nyc node_modules/mocha/bin/_mocha \"lib/**/*.integration.js\" \"services/**/*.integration.js\"",
"coverage:test:services": "nyc node_modules/mocha/bin/_mocha --delay lib/service-test-runner/cli.js",
"coverage:test": "rimraf .nyc_output coverage; npm run coverage:test:server; npm run coverage:test:frontend; npm run coverage:test:integration; npm run coverage:test:services",
"coverage:test": "rimraf .nyc_output coverage; npm run coverage:test:server; npm run coverage:test:package; npm run coverage:test:frontend; npm run coverage:test:integration; npm run coverage:test:services",
"coverage:report": "nyc report",
"coverage:report:reopen": "opn coverage/lcov-report/index.html",
"coverage:report:open": "npm run coverage:report && npm run coverage:report:reopen",
@@ -72,7 +73,7 @@
"danger": "danger",
"test:js:frontend": "NODE_ENV=mocha mocha --require @babel/polyfill --require @babel/register \"frontend/**/*.spec.js\"",
"test:js:server": "HANDLE_INTERNAL_ERRORS=false mocha \"*.spec.js\" \"lib/**/*.spec.js\" \"services/**/*.spec.js\"",
"test:js:package": "HANDLE_INTERNAL_ERRORS=false mocha \"gh-badges/**/*.spec.js\"",
"test:js:package": "mocha \"gh-badges/**/*.spec.js\"",
"test:integration": "mocha \"lib/**/*.integration.js\" \"services/**/*.integration.js\"",
"test:services": "HANDLE_INTERNAL_ERRORS=false mocha --delay lib/service-test-runner/cli.js",
"test:services:trace": "TRACE_SERVICES=true npm run test:services -- $*",
@@ -85,8 +86,8 @@
"depcheck": "check-node-version --node \">= 8.0\"",
"postinstall": "npm run depcheck",
"prebuild": "npm run depcheck",
"features": "node lib/export-supported-features-cli.js > supported-features.json",
"examples": "node lib/export-badge-examples-cli.js > badge-examples.json",
"features": "node scripts/export-supported-features-cli.js > supported-features.json",
"examples": "node scripts/export-badge-examples-cli.js > badge-examples.json",
"build": "npm run examples && npm run features && next build && next export -o build/",
"heroku-postbuild": "npm run build",
"analyze": "ANALYZE=true LONG_CACHE=false BASE_URL=https://img.shields.io npm run build",
@@ -94,7 +95,7 @@
"now-start": "node server",
"prestart": "npm run depcheck && npm run examples && npm run features",
"start": "concurrently --names server,frontend \"ALLOWED_ORIGIN=http://localhost:3000 npm run start:server\" \"BASE_URL=http://[::]:8080 next dev\"",
"refactoring-report": "node lib/refactoring-cli.js"
"refactoring-report": "node scripts/refactoring-cli.js"
},
"lint-staged": {
"**/*.js": [

View File

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

View File

@@ -5,7 +5,7 @@ const mapValues = require('lodash.mapvalues')
const colorscheme = require('../gh-badges/lib/colorscheme.json')
const colorsMap = mapValues(colorscheme, 'colorB')
const { floorCount } = require('./color-formatters')
const { floorCount } = require('../lib/color-formatters')
const { loadServiceClasses } = require('../services')
const serviceClasses = loadServiceClasses()