@@ -77,27 +77,29 @@ export class TestCoverageEvaluationPlugin {
77
77
const pointer = decodeURI ( parseIri ( schemaLocation ) . fragment ?? "" ) ;
78
78
const node = getNodeFromPointer ( tree , pointer ) ;
79
79
80
- const declRange = node . type === "json-property"
81
- ? positionToRange ( node . children [ 0 ] . position )
82
- : {
83
- start : { line : node . position . start . line , column : node . position . start . column - 1 } ,
84
- end : { line : node . position . start . line , column : node . position . start . column - 1 }
85
- } ;
86
-
87
- const locRange = positionToRange ( node . position ) ;
88
-
89
- // Create statement
90
- this . coverageMap [ schemaPath ] . statementMap [ schemaLocation ] = locRange ;
91
- this . coverageMap [ schemaPath ] . s [ schemaLocation ] = 0 ;
92
-
93
- // Create function
94
- this . coverageMap [ schemaPath ] . fnMap [ schemaLocation ] = {
95
- name : schemaLocation ,
96
- decl : declRange ,
97
- loc : locRange ,
98
- line : node . position . start . line
99
- } ;
100
- this . coverageMap [ schemaPath ] . f [ schemaLocation ] = 0 ;
80
+ if ( ! ( schemaLocation in this . coverageMap [ schemaPath ] . fnMap ) ) {
81
+ const declRange = node . type === "json-property"
82
+ ? positionToRange ( node . children [ 0 ] . position )
83
+ : {
84
+ start : { line : node . position . start . line , column : node . position . start . column - 1 } ,
85
+ end : { line : node . position . start . line , column : node . position . start . column - 1 }
86
+ } ;
87
+
88
+ const locRange = positionToRange ( node . position ) ;
89
+
90
+ // Create statement
91
+ this . coverageMap [ schemaPath ] . statementMap [ schemaLocation ] = locRange ;
92
+ this . coverageMap [ schemaPath ] . s [ schemaLocation ] = 0 ;
93
+
94
+ // Create function
95
+ this . coverageMap [ schemaPath ] . fnMap [ schemaLocation ] = {
96
+ name : schemaLocation ,
97
+ decl : declRange ,
98
+ loc : locRange ,
99
+ line : node . position . start . line
100
+ } ;
101
+ this . coverageMap [ schemaPath ] . f [ schemaLocation ] = 0 ;
102
+ }
101
103
102
104
if ( Array . isArray ( ast [ schemaLocation ] ) ) {
103
105
for ( const keywordNode of ast [ schemaLocation ] ) {
@@ -150,6 +152,7 @@ const positionToRange = (position) => {
150
152
} ;
151
153
152
154
const annotationKeywords = new Set ( [
155
+ "https://json-schema.org/keyword/comment" ,
153
156
"https://json-schema.org/keyword/title" ,
154
157
"https://json-schema.org/keyword/description" ,
155
158
"https://json-schema.org/keyword/default" ,
0 commit comments