Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit eb30bc7

Browse files
authored
ci: add test coveralls (#20)
1 parent 39fe71e commit eb30bc7

File tree

19 files changed

+149
-78
lines changed

19 files changed

+149
-78
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# production
77
/lib
88
/build
9+
/coverage
10+
/false
911

1012
# workspace
1113
.vscode

.travis.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
21
language: node_js
3-
42
node_js:
53
- "node"
64
- "8"
7-
85
notifications:
96
email: false
10-
11-
script:
12-
- commitlint-travis
13-
- npm run lint
14-
- npm run test
15-
167
branches:
178
only:
189
- master
19-
- /^greenkeeper.*$/
10+
- /^greenkeeper.*$/
11+
12+
script:
13+
- commitlint-travis
14+
- npm run test:prod && npm run build
15+
after_success:
16+
- npm run report-coverage

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
<p align="center"><img src='./media/logo.png' width="20%" alt='logo' /></p>
1+
<div align="center">
2+
<img src='./media/logo.png' width="20%" alt='logo' />
23

3-
<h1 align="center"><br>react-semantics<br></h1>
4+
<h1>react-semantics</h1>
45

5-
<h4 align="center">Semantic helper components for working with <a href="https://reactjs.org/" target="_blank">React</a>.</h4>
6+
<h4>Blazing fast semantic helper components for working with <a href="https://reactjs.org/" target="_blank">React</a>.</h4>
67

7-
<p align="center">
8+
<p>
89
<a href="https://badge.fury.io/js/react-semantics">
910
<img src="https://badge.fury.io/js/react-semantics.svg" alt="npm package" />
1011
</a>
1112
<a href="https://travis-ci.com/csvenke/react-semantics">
1213
<img src="https://travis-ci.com/csvenke/react-semantics.svg?branch=master" alt="build status" />
1314
</a>
15+
<a href='https://coveralls.io/github/csvenke/react-semantics?branch=master'>
16+
<img src='https://coveralls.io/repos/github/csvenke/react-semantics/badge.svg?branch=master' alt='Coverage Status' />
17+
</a>
1418
<a href="https://david-dm.org/csvenke/react-semantics">
1519
<img src="https://david-dm.org/csvenke/react-semantics.svg" alt="dependencies status" />
1620
</a>
@@ -22,14 +26,15 @@
2226
</a>
2327
</p>
2428

25-
<p align="center">
26-
<a href="#installation">Installation</a> •
27-
<a href="#example-usage">Example usage</a> •
28-
<a href="#documentation">Documentation</a> •
29-
<a href="#development-setup">Development setup</a> •
30-
<a href="#contributing">Contributing</a> •
31-
<a href="#license">License</a>
32-
</p>
29+
<p>
30+
<a href="#installation">Installation</a> •
31+
<a href="#example-usage">Example usage</a> •
32+
<a href="#documentation">Documentation</a> •
33+
<a href="#development-setup">Development setup</a> •
34+
<a href="#contributing">Contributing</a> •
35+
<a href="#license">License</a>
36+
</p>
37+
</div>
3338

3439
Are you tired of your react components looking like an unreadable mess?
3540
Have you often asked yourself: "there must be a better way!"?

jest.config.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ module.exports = {
33
'^.+\\.tsx?$': 'ts-jest',
44
},
55
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
6-
testPathIgnorePatterns: [
7-
'<rootDir>/node_modules/',
8-
'<rootDir>/lib/',
9-
'<rootDir>/build/',
10-
],
6+
moduleFileExtensions: ['ts', 'tsx', 'js'],
117
setupTestFrameworkScriptFile: '<rootDir>/src/setupTests.ts',
12-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8+
collectCoverage: true,
9+
coverageThreshold: {
10+
global: {
11+
branches: 80,
12+
functions: 90,
13+
lines: 90,
14+
statements: 90,
15+
},
16+
},
17+
collectCoverageFrom: ['src/@(components|utils)/**/*.@(ts|tsx)'],
18+
coveragePathIgnorePatterns: ['index.ts'],
1319
};

package-lock.json

Lines changed: 52 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
"@types/enzyme-adapter-react-16": "^1.0.2",
3737
"@types/enzyme": "^3.1.12",
3838
"@types/jest": "^23.3.0",
39+
"@types/node": "^10.5.4",
3940
"@types/prop-types": "^15.5.3",
4041
"@types/react-dom": "^16.0.6",
4142
"@types/react": "^16.4.6",
43+
"coveralls": "^3.0.2",
4244
"enzyme-adapter-react-16": "^1.1.1",
4345
"enzyme": "^3.3.0",
4446
"husky": "1.0.0-rc.13",
@@ -57,20 +59,24 @@
5759
"ts-loader": "^4.4.2",
5860
"tslint-config-prettier": "^1.14.0",
5961
"tslint-plugin-prettier": "^1.3.0",
62+
"tslint-react": "^3.6.0",
6063
"tslint": "^5.11.0",
6164
"typescript": "^2.9.2",
6265
"webpack": "^4.16.2"
6366
},
6467
"scripts": {
65-
"build": "npm run clean:build && npm run lint && npm run test && rollup -c",
68+
"build": "npm run clean:build && rollup -c",
6669
"clean:build": "rimraf ./lib && rimraf ./build",
6770
"docs:server": "styleguidist server",
6871
"docs": "styleguidist build",
69-
"lint:fix": "npm run lint:write --fix \"src/**/*.@(ts|tsx)\"",
72+
"lint:fix": "npm run lint:write --fix \"src/**/*.{ts,tsx}\"",
7073
"lint:write": "tslint -c tslint.json",
71-
"lint": "npm run lint:write \"src/**/*.@(ts|tsx)\"",
74+
"lint": "npm run lint:write \"src/**/*.{ts,tsx}\"",
7275
"prettier:write": "prettier -c .prettierrc --write",
73-
"prettier": "npm run prettier:write \"src/**/*.@(ts|tsx)\"",
76+
"prettier": "npm run prettier:write \"src/**/*.{ts,tsx}\"",
77+
"report-coverage": "cat ./coverage/lcov.info | coveralls",
78+
"test:prod": "npm run lint && npm run test --coverage --no-cache",
79+
"test:watch": "jest --watch",
7480
"test": "jest"
7581
},
7682
"husky": {
@@ -81,7 +87,7 @@
8187
}
8288
},
8389
"lint-staged": {
84-
"*.{ts,tsx}": [
90+
"{src}/**/*.{ts,tsx}": [
8591
"prettier -c .prettierrc --write",
8692
"tslint -c tslint.json --fix",
8793
"git add"

src/components/List/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/Resolve/Resolve.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
import * as PropTypes from 'prop-types';
22
import * as React from 'react';
33
import { isPromise } from '../../utils';
4-
import { statusTypes } from './config';
54

65
export interface IResolveProps {
7-
/** The promise to be resolved */
6+
/** The promise. */
87
promise?: Promise<any>;
98

10-
/** Will be displayed after promise is resolved */
9+
/** Returns content when promise is resolved. */
1110
resolved?: (value) => React.ReactNode;
1211

13-
/** Will be displayed while promise is handled */
12+
/** Returns content while promise is being handled. */
1413
pending?: React.ReactNode;
1514

16-
/** Will be displayed if promise is rejected */
15+
/** Returns content when promise is rejected. */
1716
rejected?: (error) => React.ReactNode;
1817
}
1918

19+
export const statusTypes = {
20+
none: 'none',
21+
pending: 'pending',
22+
rejected: 'rejected',
23+
resolved: 'resolved',
24+
};
25+
2026
export const initialState = {
2127
status: statusTypes.none,
2228
value: '',
@@ -26,15 +32,6 @@ export type IResolveState = Readonly<typeof initialState>;
2632

2733
/**
2834
* Returns content based on specified promise.
29-
*
30-
* @example
31-
*
32-
* <Resolve
33-
* promise={aPromise}
34-
* resolved={value => (
35-
* <p>{`Resolved value ${value}`}</p>
36-
* )}
37-
* />
3835
*/
3936
class Resolve extends React.Component<IResolveProps, IResolveState> {
4037
public static propTypes = {

src/components/Resolve/config.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components/Resolve/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)