Skip to content

Commit 8bebdb2

Browse files
authored
merge: jest Coverage에 대한 push 제한 처리 (#25)
* test: jest coverage threshold 지정 * config: husky pre-push 추가 * config: jest coverage 수집 대상 변경 * config: coverage threshold 변경 * chore: useScrollRatio 임시삭제 * fix: jest threshold 수집 범위 수정하여 파일 매치 문제 해결 * docs: contributing 문서에 테스트코드 정책 추가
1 parent 551b252 commit 8bebdb2

File tree

6 files changed

+35
-34
lines changed

6 files changed

+35
-34
lines changed

.github/CONTRIBUTING.ko.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
커뮤니티의 모든 분들의 Contribution을 환영합니다.
44
[영어](https://github.com/Rapiders/react-hooks/tree/main/.github/CONTRIBUTING.md)와 한국어 중 편한 언어를 사용하면 됩니다.
55

6+
## 테스트 코드 정책
7+
8+
라이브러리의 품질을 보증하기위해 다음의 정책이 적용됩니다.
9+
하나의 기능에 대해
10+
11+
1. branches의 coverage는 80%를 넘어야합니다. (추후 개선 100%로 변경예정)
12+
2. functions의 coverage는 80%를 넘어야합니다. (추후 개선 100%로 변경예정)
13+
3. lines는 반드시 100%여야합니다.
14+
15+
해당 정책을 만족하지 못하는 경우 `git push`가 이뤄지지 않습니다.
16+
617
## Fork
718

819
1. 기여하고 싶은 경우 우선 이 레포지토리를 fork 합니다.
9-
2. 작업이 완료되었다면 main 브랜치로 PR을 오픈합니다.
10-
3. merge 되기 위해서는 반드시 maintainer 중 한 명이 이상의 approve를 받아야 합니다.
20+
2. npm install을 진행합니다.
21+
3. 작업이 완료되었다면 main 브랜치로 PR을 오픈합니다.
22+
4. merge 되기 위해서는 반드시 maintainer 중 한 명이 이상의 approve를 받아야 합니다.
1123

1224
## Issue
1325

.github/CONTRIBUTING.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33
We welcome contribution from everyone in the community.
44
you can use English and [Korean](https://github.com/Rapiders/react-hooks/tree/main/.github/CONTRIBUTING.ko.md)
55

6+
## Test Code Policy
7+
8+
To ensure the quality of the library, the following policy is applied for each feature:
9+
10+
1. Branch coverage must exceed 80%.
11+
2. Function coverage must exceed 80%.
12+
3. Line coverage must be 100%.
13+
14+
If these requirements are not met, `git push` will not be allowed.
15+
616
## Fork
717

818
1. If you wish to contribute, first fork this repository.
9-
2. Once your work is complete, open a PR to the main branch.
10-
3. To be merged, it must receive at least one approval from a maintainer.
19+
2. npm install
20+
3. Once your work is complete, open a PR to the main branch.
21+
4. To be merged, it must receive at least one approval from a maintainer.
1122

1223
## Issue
1324

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run test:coverage

jest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ module.exports = {
1515
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
1616
prefix: '<rootDir>',
1717
}),
18+
coverageThreshold: {
19+
'src/**/*.{ts,tsx}': {
20+
branches: 80,
21+
functions: 80,
22+
lines: 100,
23+
},
24+
},
1825
};

src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import useAnimation from './useAnimation/useAnimation';
33
import useFocusAnimation from './useFocusAnimation/useFocusAnimation';
44
import useDragIndexCarousel from './useDragIndexCarousel/useDragIndexCarousel';
55
import useCarousel from './useCarousel/useCarousel';
6-
import useScrollRatio from './useScrollRatio';
76
import useInterval from './useInterval/useInterval';
87
import useAfterMountEffect from './useAfterMountEffect/useAfterMountEffect';
98
import useRadio from './useRadio/useRadio';
@@ -19,7 +18,6 @@ export {
1918
useFocusAnimation,
2019
useDragIndexCarousel,
2120
useCarousel,
22-
useScrollRatio,
2321
useInterval,
2422
useAfterMountEffect,
2523
useRadio,

src/useScrollRatio.ts

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

0 commit comments

Comments
 (0)