Skip to content

Commit

Permalink
Merge pull request #1866 from artsy/add-test-coverage
Browse files Browse the repository at this point in the history
Add code coverage reporting
  • Loading branch information
dleve123 authored Jan 23, 2019
2 parents 1971441 + dcec5f0 commit 6963ebf
Show file tree
Hide file tree
Showing 12 changed files with 1,942 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- setup_remote_docker
- run:
name: Test
command: COMMIT_HASH=$(git rev-parse --short HEAD) hokusai test --build
command: COMMIT_HASH=$(git rev-parse HEAD) CODECOV_TOKEN=$CODECOV_TOKEN BRANCH_NAME=$CIRCLE_BRANCH hokusai test --build
deploy-staging:
docker:
- image: artsy/hokusai
Expand Down
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ GEMINI_KEY=REPLACE

# Needed to link Reaction: `yarn link @artsy/reaction`
GRAPHQL_ENDPOINT=https://metaphysics-staging.artsy.net

# Token used to authenticate with the code coverage tracking tool Codecov.
# Token not needed when running tests during dev, intended to only be set
# during CI.
CODECOV_TOKEN
BRANCH_NAME
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ data
/public
/src/client/public/assets
/node_modules

coverage.lcov
.nyc_output/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:10.13-alpine
ARG COMMIT_HASH
RUN test -n "$COMMIT_HASH"

RUN apk add curl git nginx
RUN apk add curl git nginx bash

# Set up deploy user and working directory
RUN adduser -D -g '' deploy
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[Positron](https://github.com/artsy/positron) is Artsy Writer or the editorial tool for Artsy.

[![codecov](https://codecov.io/gh/artsy/positron/branch/master/graph/badge.svg)](https://codecov.io/gh/artsy/positron)
![ArtsyWriter](/doc/images/ArtsyWriter.png)

## Meta
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
"prettier-project": "yarn run prettier-write 'src/**/*.{ts,tsx,js,jsx}'",
"prettier-write": "yarn run prettier --write",
"mocha": "sh scripts/mocha.sh",
"jest": "sh scripts/jest.sh",
"start": "sh scripts/start.sh",
"production": "sh scripts/production.sh",
"publish-assets": "sh scripts/publish-assets.sh",
"task": "node -r coffeescript/register -r @babel/register -r dotenv/config",
"test:watch": "yarn jest -- --watch --runInBand",
"test": "sh scripts/test.sh",
"type-check": "tsc --pretty --noEmit"
"type-check": "tsc --pretty --noEmit",
"normalize-jest-coverage": "node scripts/normalize-jest-coverage.js",
"create-merged-coverage": "nyc report --reporter=text-lcov > coverage.lcov",
"report-coverage": "./scripts/codecov -C $(cat COMMIT_HASH.txt) -p app/ -B $BRANCH_NAME -f coverage.lcov",
"publish-coverage": "yarn normalize-jest-coverage && yarn create-merged-coverage && yarn report-coverage"
},
"resolutions": {
"babel-core": "^7.0.0-0",
Expand Down Expand Up @@ -181,6 +186,8 @@
"json-loader": "^0.5.7",
"lint-staged": "^7.2.2",
"mocha": "^3.1.2",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^13.1.0",
"progress-bar-webpack-plugin": "^1.10.0",
"raf": "^3.4.0",
"react-addons-test-utils": "^15.4.2",
Expand Down
Loading

0 comments on commit 6963ebf

Please sign in to comment.