Skip to content

Commit 6db69f7

Browse files
authored
increase test coverage to 100% (#189)
* increase test coverage to 100% * always test for coverage
1 parent fa4ec7a commit 6db69f7

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- run: |
5454
npm install --ignore-scripts
5555
npm run build --if-present
56-
npm run test:coverage
56+
npm run test
5757
- name: Coveralls Parallel
5858
uses: coverallsapp/github-action@1.1.3
5959
with:

jest.config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"collectCoverageFrom": [
3+
"src/**/*.js",
4+
"!src/example.js",
5+
"!src/types/*.js"
6+
],
7+
"coverageReporters": [
8+
"text",
9+
"lcovonly"
10+
],
11+
"coverageThreshold": {
12+
"global": {
13+
"branches": 100,
14+
"functions": 100,
15+
"lines": 100,
16+
"statements": 100
17+
}
18+
}
19+
}

package.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,6 @@
2626
"type": "git",
2727
"url": "https://github.com/fastify/fluent-json-schema.git"
2828
},
29-
"jest": {
30-
"collectCoverageFrom": [
31-
"src/**/*.js",
32-
"!src/example.js",
33-
"!src/types/*.js"
34-
],
35-
"coverageReporters": [
36-
"text",
37-
"lcovonly"
38-
]
39-
},
4029
"lint-staged": {
4130
"*.{json,md,js,ts,yml}": [
4231
"prettier --write",
@@ -45,8 +34,7 @@
4534
},
4635
"scripts": {
4736
"test": "npm run test:unit && npm run test:typescript",
48-
"test:unit": "jest src/*.test.js --verbose",
49-
"test:coverage": "jest --coverage && npm run test:typescript",
37+
"test:unit": "jest --coverage",
5038
"test:watch": "jest src/*.test.js --verbose --watch",
5139
"test:typescript": "tsd",
5240
"prepare": "husky install",

src/utils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ const patchIdsWithParentId = ({ schema, generateIds, parentId }) => {
131131
return {
132132
...schema,
133133
properties: properties.reduce((memo, [key, props]) => {
134-
const target = props.def ? 'definitions' : 'properties'
135-
const $id = props.$id || (generateIds ? `#${target}/${key}` : undefined)
134+
const $id = props.$id || (generateIds ? `#properties/${key}` : undefined)
136135
return {
137136
...memo,
138137
[key]: {

0 commit comments

Comments
 (0)