@@ -33,7 +33,7 @@ export class TestCoverageEvaluationPlugin {
33
33
34
34
const schemaPath = fileURLToPath ( keywordLocation ) ;
35
35
this . coverageMap [ schemaPath ] . s [ keywordLocation ] ++ ;
36
- this . coverageMap [ schemaPath ] . b [ keywordLocation ] [ Number ( valid ) ] ++ ;
36
+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] [ Number ( ! valid ) ] ++ ;
37
37
}
38
38
39
39
/** @type NonNullable<EvaluationPlugin["afterSchema"]> */
@@ -102,7 +102,7 @@ export class TestCoverageEvaluationPlugin {
102
102
if ( Array . isArray ( ast [ schemaLocation ] ) ) {
103
103
for ( const keywordNode of ast [ schemaLocation ] ) {
104
104
if ( Array . isArray ( keywordNode ) ) {
105
- const [ , keywordLocation ] = keywordNode ;
105
+ const [ keywordUri , keywordLocation ] = keywordNode ;
106
106
107
107
if ( keywordLocation in this . coverageMap [ schemaPath ] . branchMap ) {
108
108
continue ;
@@ -117,13 +117,23 @@ export class TestCoverageEvaluationPlugin {
117
117
this . coverageMap [ schemaPath ] . s [ keywordLocation ] = 0 ;
118
118
119
119
// Create branch
120
- this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
121
- line : range . start . line ,
122
- type : "keyword" ,
123
- loc : range ,
124
- locations : [ range , range ]
125
- } ;
126
- this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 , 0 ] ;
120
+ if ( annotationKeywords . has ( keywordUri ) ) {
121
+ this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
122
+ line : range . start . line ,
123
+ type : "keyword" ,
124
+ loc : range ,
125
+ locations : [ range ]
126
+ } ;
127
+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 ] ;
128
+ } else {
129
+ this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
130
+ line : range . start . line ,
131
+ type : "keyword" ,
132
+ loc : range ,
133
+ locations : [ range , range ]
134
+ } ;
135
+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 , 0 ] ;
136
+ }
127
137
}
128
138
}
129
139
}
@@ -138,3 +148,14 @@ const positionToRange = (position) => {
138
148
end : { line : position . end . line , column : position . end . column - 1 }
139
149
} ;
140
150
} ;
151
+
152
+ const annotationKeywords = new Set ( [
153
+ "https://json-schema.org/keyword/title" ,
154
+ "https://json-schema.org/keyword/description" ,
155
+ "https://json-schema.org/keyword/default" ,
156
+ "https://json-schema.org/keyword/deprecated" ,
157
+ "https://json-schema.org/keyword/readOnly" ,
158
+ "https://json-schema.org/keyword/writeOnly" ,
159
+ "https://json-schema.org/keyword/examples" ,
160
+ "https://json-schema.org/keyword/format"
161
+ ] ) ;
0 commit comments