Skip to content

Commit 7a3871b

Browse files
committed
Integrate test coverage reporter
1 parent 5821ea4 commit 7a3871b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ cache:
1010
install:
1111
- yarn install --frozen-lockfile
1212

13+
before_script:
14+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15+
- chmod +x ./cc-test-reporter
16+
1317
script:
18+
- yarn test
19+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./cc-test-reporter format-coverage -t lcov coverage/lcov.info -o coverage/codeclimate.json; fi'
1420
- yarn build:rollup
1521
- yarn build:storybook
1622

23+
after_script:
24+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./cc-test-reporter upload-coverage; fi'
25+
1726
deploy:
1827
- provider: pages
1928
local_dir: storybook-static

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ module.exports = {
77
'^.+\\.tsx?$': 'ts-jest'
88
},
99
testMatch: ['**/*.test.(ts|tsx)'],
10+
collectCoverageFrom: ['**/!(*.stories).(ts|tsx)'],
1011
moduleNameMapper: {}
1112
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
"scripts": {
5050
"build": "yarn build:rollup",
5151
"dev": "yarn dev:storybook",
52-
"test": "jest",
52+
"test": "jest --coverage",
5353
"pretest": "yarn build",
54-
"dev:test": "jest --watch",
54+
"dev:test": "jest --watchAll --coverage",
5555
"dev:rollup": "rollup -c --w",
5656
"dev:storybook": "start-storybook -p 6006",
5757
"build:rollup": "rollup -c",

0 commit comments

Comments
 (0)