Skip to content

Commit

Permalink
Coverage cleanup (badges#2328)
Browse files Browse the repository at this point in the history
- 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: badges#1584 badges#2314
  • Loading branch information
paulmelnikow authored Nov 17, 2018
1 parent 547380f commit ff9cd20
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 31 deletions.
23 changes: 0 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -270,13 +257,3 @@ workflows:
filters:
branches:
ignore: /dependabot\/.*/

daily:
triggers:
- schedule:
cron: "0 17 * * *"
filters:
branches:
only: master
jobs:
- services-daily
3 changes: 3 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"exclude": [
"**/*.spec.js",
"**/*.integration.js",
"dangerfile.js",
"services/**/*.tester.js",
"test-fixtures",
"scripts",
"coverage",
"build"
],
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
-----------------------
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 -- $*",
Expand All @@ -85,16 +86,16 @@
"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",
"start:server": "HANDLE_INTERNAL_ERRORS=false RATE_LIMIT=false node server 8080 ::",
"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": [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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))
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/refactoring-cli.js → scripts/refactoring-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ff9cd20

Please sign in to comment.