Skip to content

Commit b5350a5

Browse files
committed
$defs/definitions is not a statement
1 parent c8b47ef commit b5350a5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/coverage-util.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { fromJson, fromYaml, getNodeFromPointer } from "./json-util.js";
1010
* @import { Position } from "unist"
1111
* @import { FileCoverageData, Range } from "istanbul-lib-coverage"
1212
* @import { SchemaObject } from "@hyperjump/json-schema"
13-
* @import { JsonNode } from "./jsonast.d.ts"
1413
* @import * as API from "./coverage-util.d.ts"
1514
*/
1615

@@ -66,7 +65,7 @@ export const astToCoverageMap = (compiledSchema, schemaPath, schemaNodes) => {
6665
if (Array.isArray(keywordNode)) {
6766
const [keywordUri, keywordLocation] = keywordNode;
6867

69-
if (keywordUri === "https://json-schema.org/keyword/comment") {
68+
if (nonStatementKeywords.has(keywordUri)) {
7069
continue;
7170
}
7271

@@ -106,8 +105,12 @@ const positionToRange = (position) => {
106105
};
107106
};
108107

108+
const nonStatementKeywords = new Set([
109+
"https://json-schema.org/keyword/comment",
110+
"https://json-schema.org/keyword/definitions"
111+
]);
112+
109113
const nonBranchingKeywords = new Set([
110-
"https://json-schema.org/keyword/definitions",
111114
"https://json-schema.org/keyword/title",
112115
"https://json-schema.org/keyword/description",
113116
"https://json-schema.org/keyword/default",

0 commit comments

Comments
 (0)