Skip to content

Commit

Permalink
infra: Add coverage reporting to CI build (#7)
Browse files Browse the repository at this point in the history
This commit introduces a new test script for CI that includes coverage
reporting with Jest and Coveralls. It also uses Jests `--ci` option.
From the docs:

> When this option is provided, Jest will assume it is running in a CI
> environment. This changes the behavior when a new snapshot is
> encountered. Instead of the regular behavior of storing a new
> snapshot automatically, it will fail the test and require Jest to be
> run with `--updateSnapshot`.

The result from the coverage report is piped to a `coveralls` util
which takes care of submitting the coverage report to Coveralls and
further on to Github.

Travis will use this new CI script so we get Coveralls reporting on
pull requests.
  • Loading branch information
wkillerud committed Mar 8, 2018
1 parent 29bb1cf commit d1dac0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
node_modules

# Built files
coverage/
dist/
lib/
src/styleguidist.html
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cache:
- "node_modules"
script:
- npm run build
- npm test
- npm run test:ci
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"styleguidist:server": "styleguidist server",
"styleguidist:build": "styleguidist build",
"test": "jest",
"test:ci": "jest --ci --coverage && cat ./coverage/lcov.info | coveralls && rimraf ./coverage",
"test:watch": "jest --watch"
},
"devDependencies": {
Expand All @@ -41,6 +42,7 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"case": "^1.5.4",
"coveralls": "^3.0.0",
"css-loader": "^0.28.7",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
Expand Down

0 comments on commit d1dac0e

Please sign in to comment.