Skip to content

Commit

Permalink
increase test coverage to 100% (fastify#189)
Browse files Browse the repository at this point in the history
* increase test coverage to 100%

* always test for coverage
  • Loading branch information
Uzlopak authored Aug 30, 2022
1 parent fa4ec7a commit 6db69f7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- run: |
npm install --ignore-scripts
npm run build --if-present
npm run test:coverage
npm run test
- name: Coveralls Parallel
uses: coverallsapp/[email protected]
with:
Expand Down
19 changes: 19 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"collectCoverageFrom": [
"src/**/*.js",
"!src/example.js",
"!src/types/*.js"
],
"coverageReporters": [
"text",
"lcovonly"
],
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
}
}
14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@
"type": "git",
"url": "https://github.com/fastify/fluent-json-schema.git"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.js",
"!src/example.js",
"!src/types/*.js"
],
"coverageReporters": [
"text",
"lcovonly"
]
},
"lint-staged": {
"*.{json,md,js,ts,yml}": [
"prettier --write",
Expand All @@ -45,8 +34,7 @@
},
"scripts": {
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "jest src/*.test.js --verbose",
"test:coverage": "jest --coverage && npm run test:typescript",
"test:unit": "jest --coverage",
"test:watch": "jest src/*.test.js --verbose --watch",
"test:typescript": "tsd",
"prepare": "husky install",
Expand Down
3 changes: 1 addition & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ const patchIdsWithParentId = ({ schema, generateIds, parentId }) => {
return {
...schema,
properties: properties.reduce((memo, [key, props]) => {
const target = props.def ? 'definitions' : 'properties'
const $id = props.$id || (generateIds ? `#${target}/${key}` : undefined)
const $id = props.$id || (generateIds ? `#properties/${key}` : undefined)
return {
...memo,
[key]: {
Expand Down

0 comments on commit 6db69f7

Please sign in to comment.