Skip to content

Commit

Permalink
chore(coveralls): setup coverage reporting
Browse files Browse the repository at this point in the history
- install and configure coveralls for test coverage reporting
- configure travis to run coverage script
- add new test file
- configure jest to transform imported css

[Finishes #162953723]
  • Loading branch information
akhilome committed Jan 10, 2019
1 parent 44c87fa commit 5fa3fb9
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
dist
coverage
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ cache:
- node_modules
script:
- npm test
- npm run coveralls
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# kiakiafood [![Build Status](https://travis-ci.org/akhilome/kiakiafood.svg?branch=develop)](https://travis-ci.org/akhilome/kiakiafood)
# kiakiafood [![Build Status](https://travis-ci.org/akhilome/kiakiafood.svg?branch=develop)](https://travis-ci.org/akhilome/kiakiafood) [![Coverage Status](https://coveralls.io/repos/github/akhilome/kiakiafood/badge.svg?branch=develop)](https://coveralls.io/github/akhilome/kiakiafood?branch=develop)

A resturant delivery application
5 changes: 4 additions & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"setupFiles": ["<rootDir>/src/tests/setupTests.js"],
"snapshotSerializers": ["enzyme-to-json/serializer"]
"snapshotSerializers": ["enzyme-to-json/serializer"],
"moduleNameMapper": {
"\\.(css)$": "<rootDir>/src/tests/__mocks__/styleMock.js"
}
}
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"main": "index.js",
"scripts": {
"test": "jest --config=jest.config.json",
"coverage": "npm run test -- --coverage",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"build": "webpack --config webpack.config.prod.js",
"dev": "webpack-dev-server --open --config webpack.config.dev.js",
"dev:hot": "npm run dev -- --hot"
Expand Down Expand Up @@ -39,6 +41,7 @@
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.5",
"coveralls": "^3.0.2",
"css-loader": "^2.1.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
Expand Down
1 change: 1 addition & 0 deletions src/tests/__mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
10 changes: 10 additions & 0 deletions src/tests/components/App.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import App from '../../components/App';

describe('App component', () => {
it('should render app correctly', () => {
const wrapper = shallow(<App />);
expect(wrapper).toMatchSnapshot();
});
});
24 changes: 24 additions & 0 deletions src/tests/components/__snapshots__/App.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`App component should render app correctly 1`] = `
<BrowserRouter>
<Switch>
<Route
component={[Function]}
exact={true}
path="/"
/>
<Route
component={[Function]}
path="/login"
/>
<Route
component={[Function]}
path="/signup"
/>
<Route
component={[Function]}
/>
</Switch>
</BrowserRouter>
`;

0 comments on commit 5fa3fb9

Please sign in to comment.