@apidevtools/json-schema-ref-parser 14.0.2 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,7 +69,9 @@ function bundle(parser, options) {
69
69
  */
70
70
  function crawl(parent, key, path, pathFromRoot, indirections, inventory, $refs, options) {
71
71
  const obj = key === null ? parent : parent[key];
72
- if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) {
72
+ const bundleOptions = (options.bundle || {});
73
+ const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
74
+ if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
73
75
  if (ref_js_1.default.isAllowed$Ref(obj)) {
74
76
  inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options);
75
77
  }
@@ -102,6 +104,9 @@ function crawl(parent, key, path, pathFromRoot, indirections, inventory, $refs,
102
104
  else {
103
105
  crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
104
106
  }
107
+ if (value["$ref"]) {
108
+ bundleOptions?.onBundle?.(value["$ref"], obj[key], obj, key);
109
+ }
105
110
  }
106
111
  }
107
112
  }
package/dist/lib/index.js CHANGED
@@ -69,22 +69,20 @@ Object.defineProperty(exports, "isUnsafeUrl", { enumerable: true, get: function
69
69
  * @class
70
70
  */
71
71
  class $RefParser {
72
- constructor() {
73
- /**
74
- * The parsed (and possibly dereferenced) JSON schema object
75
- *
76
- * @type {object}
77
- * @readonly
78
- */
79
- this.schema = null;
80
- /**
81
- * The resolved JSON references
82
- *
83
- * @type {$Refs}
84
- * @readonly
85
- */
86
- this.$refs = new refs_js_1.default();
87
- }
72
+ /**
73
+ * The parsed (and possibly dereferenced) JSON schema object
74
+ *
75
+ * @type {object}
76
+ * @readonly
77
+ */
78
+ schema = null;
79
+ /**
80
+ * The resolved JSON references
81
+ *
82
+ * @type {$Refs}
83
+ * @readonly
84
+ */
85
+ $refs = new refs_js_1.default();
88
86
  async parse() {
89
87
  const args = (0, normalize_args_js_1.default)(arguments);
90
88
  let promise;
@@ -2,6 +2,23 @@ import type { HTTPResolverOptions, JSONSchema, JSONSchemaObject, Plugin, Resolve
2
2
  export type DeepPartial<T> = T extends object ? {
3
3
  [P in keyof T]?: DeepPartial<T[P]>;
4
4
  } : T;
5
+ export interface BundleOptions {
6
+ /**
7
+ * A function, called for each path, which can return true to stop this path and all
8
+ * subpaths from being processed further. This is useful in schemas where some
9
+ * subpaths contain literal $ref keys that should not be changed.
10
+ */
11
+ excludedPathMatcher?(path: string): boolean;
12
+ /**
13
+ * Callback invoked during bundling.
14
+ *
15
+ * @argument {string} path - The path being processed (ie. the `$ref` string)
16
+ * @argument {JSONSchemaObject} value - The JSON-Schema that the `$ref` resolved to
17
+ * @argument {JSONSchemaObject} parent - The parent of the processed object
18
+ * @argument {string} parentPropName - The prop name of the parent object whose value was processed
19
+ */
20
+ onBundle?(path: string, value: JSONSchemaObject, parent?: JSONSchemaObject, parentPropName?: string): void;
21
+ }
5
22
  export interface DereferenceOptions {
6
23
  /**
7
24
  * Determines whether circular `$ref` pointers are handled.
@@ -88,6 +105,10 @@ export interface $RefParserOptions<S extends object = JSONSchema> {
88
105
  * that were encountered.
89
106
  */
90
107
  continueOnError: boolean;
108
+ /**
109
+ * The `bundle` options control how JSON Schema `$Ref` Parser will process `$ref` pointers within the JSON schema.
110
+ */
111
+ bundle: BundleOptions;
91
112
  /**
92
113
  * The `dereference` options control how JSON Schema `$Ref` Parser will dereference `$ref` pointers within the JSON schema.
93
114
  */
@@ -48,6 +48,19 @@ const getJsonSchemaRefParserDefaultOptions = () => {
48
48
  * that were encountered.
49
49
  */
50
50
  continueOnError: false,
51
+ /**
52
+ * Determines the types of JSON references that are allowed.
53
+ */
54
+ bundle: {
55
+ /**
56
+ * A function, called for each path, which can return true to stop this path and all
57
+ * subpaths from being processed further. This is useful in schemas where some
58
+ * subpaths contain literal $ref keys that should not be changed.
59
+ *
60
+ * @type {function}
61
+ */
62
+ excludedPathMatcher: () => false,
63
+ },
51
64
  /**
52
65
  * Determines the types of JSON references that are allowed.
53
66
  */
@@ -62,6 +62,33 @@ const safeDecodeURIComponent = (encodedURIComponent) => {
62
62
  * @class
63
63
  */
64
64
  class Pointer {
65
+ /**
66
+ * The {@link $Ref} object that contains this {@link Pointer} object.
67
+ */
68
+ $ref;
69
+ /**
70
+ * The file path or URL, containing the JSON pointer in the hash.
71
+ * This path is relative to the path of the main JSON schema file.
72
+ */
73
+ path;
74
+ /**
75
+ * The original path or URL, used for error messages.
76
+ */
77
+ originalPath;
78
+ /**
79
+ * The value of the JSON pointer.
80
+ * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
81
+ */
82
+ value;
83
+ /**
84
+ * Indicates whether the pointer references itself.
85
+ */
86
+ circular;
87
+ /**
88
+ * The number of indirect references that were traversed to resolve the value.
89
+ * Resolving a single pointer may require resolving multiple $Refs.
90
+ */
91
+ indirections;
65
92
  constructor($ref, path, friendlyPath) {
66
93
  this.$ref = $ref;
67
94
  this.path = path;
package/dist/lib/ref.js CHANGED
@@ -42,11 +42,39 @@ const url_js_1 = require("./util/url.js");
42
42
  * @class
43
43
  */
44
44
  class $Ref {
45
+ /**
46
+ * The file path or URL of the referenced file.
47
+ * This path is relative to the path of the main JSON schema file.
48
+ *
49
+ * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file.
50
+ * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get
51
+ * specific JSON pointers within the file.
52
+ *
53
+ * @type {string}
54
+ */
55
+ path;
56
+ /**
57
+ * The resolved value of the JSON reference.
58
+ * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays).
59
+ *
60
+ * @type {?*}
61
+ */
62
+ value;
63
+ /**
64
+ * The {@link $Refs} object that contains this {@link $Ref} object.
65
+ *
66
+ * @type {$Refs}
67
+ */
68
+ $refs;
69
+ /**
70
+ * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.)
71
+ */
72
+ pathType;
73
+ /**
74
+ * List of all errors. Undefined if no errors.
75
+ */
76
+ errors = [];
45
77
  constructor($refs) {
46
- /**
47
- * List of all errors. Undefined if no errors.
48
- */
49
- this.errors = [];
50
78
  this.$refs = $refs;
51
79
  }
52
80
  /**
package/dist/lib/refs.js CHANGED
@@ -47,6 +47,12 @@ const convert_path_to_posix_1 = __importDefault(require("./util/convert-path-to-
47
47
  * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
48
48
  */
49
49
  class $Refs {
50
+ /**
51
+ * This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.
52
+ *
53
+ * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
54
+ */
55
+ circular;
50
56
  /**
51
57
  * Returns the paths/URLs of all the files in your schema (including the main schema file).
52
58
  *
@@ -166,33 +172,21 @@ class $Refs {
166
172
  }
167
173
  return $ref.resolve(absPath, options, path, pathFromRoot);
168
174
  }
175
+ /**
176
+ * A map of paths/urls to {@link $Ref} objects
177
+ *
178
+ * @type {object}
179
+ * @protected
180
+ */
181
+ _$refs = {};
182
+ /**
183
+ * The {@link $Ref} object that is the root of the JSON schema.
184
+ *
185
+ * @type {$Ref}
186
+ * @protected
187
+ */
188
+ _root$Ref;
169
189
  constructor() {
170
- /**
171
- * A map of paths/urls to {@link $Ref} objects
172
- *
173
- * @type {object}
174
- * @protected
175
- */
176
- this._$refs = {};
177
- /**
178
- * Returns the paths of all the files/URLs that are referenced by the JSON schema,
179
- * including the schema itself.
180
- *
181
- * @param [types] - Only return paths of the given types ("file", "http", etc.)
182
- * @returns
183
- */
184
- /**
185
- * Returns the map of JSON references and their resolved values.
186
- *
187
- * @param [types] - Only return references of the given types ("file", "http", etc.)
188
- * @returns
189
- */
190
- /**
191
- * Returns a POJO (plain old JavaScript object) for serialization as JSON.
192
- *
193
- * @returns {object}
194
- */
195
- this.toJSON = this.values;
196
190
  /**
197
191
  * Indicates whether the schema contains any circular references.
198
192
  *
@@ -203,6 +197,25 @@ class $Refs {
203
197
  // @ts-ignore
204
198
  this._root$Ref = null;
205
199
  }
200
+ /**
201
+ * Returns the paths of all the files/URLs that are referenced by the JSON schema,
202
+ * including the schema itself.
203
+ *
204
+ * @param [types] - Only return paths of the given types ("file", "http", etc.)
205
+ * @returns
206
+ */
207
+ /**
208
+ * Returns the map of JSON references and their resolved values.
209
+ *
210
+ * @param [types] - Only return references of the given types ("file", "http", etc.)
211
+ * @returns
212
+ */
213
+ /**
214
+ * Returns a POJO (plain old JavaScript object) for serialization as JSON.
215
+ *
216
+ * @returns {object}
217
+ */
218
+ toJSON = this.values;
206
219
  }
207
220
  exports.default = $Refs;
208
221
  /**
@@ -82,7 +82,7 @@ function resolveExternal(parser, options) {
82
82
  * then the corresponding promise will internally reference an array of promises.
83
83
  */
84
84
  function crawl(obj, path, $refs, options, seen, external) {
85
- seen || (seen = new Set());
85
+ seen ||= new Set();
86
86
  let promises = [];
87
87
  if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
88
88
  seen.add(obj); // Track previously seen objects to avoid infinite recursion
@@ -53,7 +53,7 @@ exports.default = {
53
53
  /**
54
54
  * HTTP request timeout (in milliseconds).
55
55
  */
56
- timeout: 60000, // 60 seconds
56
+ timeout: 60_000, // 60 seconds
57
57
  /**
58
58
  * The maximum number of HTTP redirects to follow.
59
59
  * To disable automatic following of redirects, set this to zero.
@@ -49,28 +49,34 @@ function getDeepKeys(obj, omit = []) {
49
49
  return uniqueKeys;
50
50
  }
51
51
  class JSONParserError extends Error {
52
+ name;
53
+ message;
54
+ source;
55
+ path;
56
+ code;
52
57
  constructor(message, source) {
53
58
  super();
54
- this.toJSON = toJSON.bind(this);
55
59
  this.code = "EUNKNOWN";
56
60
  this.name = "JSONParserError";
57
61
  this.message = message;
58
62
  this.source = source;
59
63
  this.path = null;
60
64
  }
65
+ toJSON = toJSON.bind(this);
61
66
  get footprint() {
62
67
  return `${this.path}+${this.source}+${this.code}+${this.message}`;
63
68
  }
64
69
  }
65
70
  exports.JSONParserError = JSONParserError;
66
71
  class JSONParserErrorGroup extends Error {
72
+ files;
67
73
  constructor(parser) {
68
74
  super();
69
- this.toJSON = toJSON.bind(this);
70
75
  this.files = parser;
71
76
  this.name = "JSONParserErrorGroup";
72
77
  this.message = `${this.errors.length} error${this.errors.length > 1 ? "s" : ""} occurred while reading '${(0, url_js_1.toFileSystemPath)(parser.$refs._root$Ref.path)}'`;
73
78
  }
79
+ toJSON = toJSON.bind(this);
74
80
  static getParserErrors(parser) {
75
81
  const errors = [];
76
82
  for (const $ref of Object.values(parser.$refs._$refs)) {
@@ -86,26 +92,27 @@ class JSONParserErrorGroup extends Error {
86
92
  }
87
93
  exports.JSONParserErrorGroup = JSONParserErrorGroup;
88
94
  class ParserError extends JSONParserError {
95
+ code = "EPARSER";
96
+ name = "ParserError";
89
97
  constructor(message, source) {
90
98
  super(`Error parsing ${source}: ${message}`, source);
91
- this.code = "EPARSER";
92
- this.name = "ParserError";
93
99
  }
94
100
  }
95
101
  exports.ParserError = ParserError;
96
102
  class UnmatchedParserError extends JSONParserError {
103
+ code = "EUNMATCHEDPARSER";
104
+ name = "UnmatchedParserError";
97
105
  constructor(source) {
98
106
  super(`Could not find parser for "${source}"`, source);
99
- this.code = "EUNMATCHEDPARSER";
100
- this.name = "UnmatchedParserError";
101
107
  }
102
108
  }
103
109
  exports.UnmatchedParserError = UnmatchedParserError;
104
110
  class ResolverError extends JSONParserError {
111
+ code = "ERESOLVER";
112
+ name = "ResolverError";
113
+ ioErrorCode;
105
114
  constructor(ex, source) {
106
115
  super(ex.message || `Error reading file "${source}"`, source);
107
- this.code = "ERESOLVER";
108
- this.name = "ResolverError";
109
116
  if ("code" in ex) {
110
117
  this.ioErrorCode = String(ex.code);
111
118
  }
@@ -113,18 +120,22 @@ class ResolverError extends JSONParserError {
113
120
  }
114
121
  exports.ResolverError = ResolverError;
115
122
  class UnmatchedResolverError extends JSONParserError {
123
+ code = "EUNMATCHEDRESOLVER";
124
+ name = "UnmatchedResolverError";
116
125
  constructor(source) {
117
126
  super(`Could not find resolver for "${source}"`, source);
118
- this.code = "EUNMATCHEDRESOLVER";
119
- this.name = "UnmatchedResolverError";
120
127
  }
121
128
  }
122
129
  exports.UnmatchedResolverError = UnmatchedResolverError;
123
130
  class MissingPointerError extends JSONParserError {
131
+ code = "EMISSINGPOINTER";
132
+ name = "MissingPointerError";
133
+ targetToken;
134
+ targetRef;
135
+ targetFound;
136
+ parentPath;
124
137
  constructor(token, path, targetRef, targetFound, parentPath) {
125
138
  super(`Missing $ref pointer "${(0, url_js_1.getHash)(path)}". Token "${token}" does not exist.`, (0, url_js_1.stripHash)(path));
126
- this.code = "EMISSINGPOINTER";
127
- this.name = "MissingPointerError";
128
139
  this.targetToken = token;
129
140
  this.targetRef = targetRef;
130
141
  this.targetFound = targetFound;
@@ -133,18 +144,18 @@ class MissingPointerError extends JSONParserError {
133
144
  }
134
145
  exports.MissingPointerError = MissingPointerError;
135
146
  class TimeoutError extends JSONParserError {
147
+ code = "ETIMEOUT";
148
+ name = "TimeoutError";
136
149
  constructor(timeout) {
137
150
  super(`Dereferencing timeout reached: ${timeout}ms`);
138
- this.code = "ETIMEOUT";
139
- this.name = "TimeoutError";
140
151
  }
141
152
  }
142
153
  exports.TimeoutError = TimeoutError;
143
154
  class InvalidPointerError extends JSONParserError {
155
+ code = "EUNMATCHEDRESOLVER";
156
+ name = "InvalidPointerError";
144
157
  constructor(pointer, path) {
145
158
  super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(path));
146
- this.code = "EUNMATCHEDRESOLVER";
147
- this.name = "InvalidPointerError";
148
159
  }
149
160
  }
150
161
  exports.InvalidPointerError = InvalidPointerError;
@@ -90,7 +90,7 @@ async function run(plugins, method, file, $refs) {
90
90
  // console.log(' success');
91
91
  resolve({
92
92
  plugin,
93
- result,
93
+ result: result,
94
94
  });
95
95
  }
96
96
  function onError(error) {
package/lib/bundle.ts CHANGED
@@ -5,6 +5,7 @@ import type $Refs from "./refs.js";
5
5
  import type $RefParser from "./index";
6
6
  import type { ParserOptions } from "./index";
7
7
  import type { JSONSchema } from "./index";
8
+ import type { BundleOptions } from "./options";
8
9
 
9
10
  export interface InventoryEntry {
10
11
  $ref: any;
@@ -65,8 +66,10 @@ function crawl<S extends object = JSONSchema, O extends ParserOptions<S> = Parse
65
66
  options: O,
66
67
  ) {
67
68
  const obj = key === null ? parent : parent[key as keyof typeof parent];
69
+ const bundleOptions = (options.bundle || {}) as BundleOptions;
70
+ const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
68
71
 
69
- if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) {
72
+ if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
70
73
  if ($Ref.isAllowed$Ref(obj)) {
71
74
  inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options);
72
75
  } else {
@@ -97,6 +100,10 @@ function crawl<S extends object = JSONSchema, O extends ParserOptions<S> = Parse
97
100
  } else {
98
101
  crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
99
102
  }
103
+
104
+ if (value["$ref"]) {
105
+ bundleOptions?.onBundle?.(value["$ref"], obj[key], obj as any, key);
106
+ }
100
107
  }
101
108
  }
102
109
  }
package/lib/options.ts CHANGED
@@ -12,6 +12,26 @@ export type DeepPartial<T> = T extends object
12
12
  [P in keyof T]?: DeepPartial<T[P]>;
13
13
  }
14
14
  : T;
15
+
16
+ export interface BundleOptions {
17
+ /**
18
+ * A function, called for each path, which can return true to stop this path and all
19
+ * subpaths from being processed further. This is useful in schemas where some
20
+ * subpaths contain literal $ref keys that should not be changed.
21
+ */
22
+ excludedPathMatcher?(path: string): boolean;
23
+
24
+ /**
25
+ * Callback invoked during bundling.
26
+ *
27
+ * @argument {string} path - The path being processed (ie. the `$ref` string)
28
+ * @argument {JSONSchemaObject} value - The JSON-Schema that the `$ref` resolved to
29
+ * @argument {JSONSchemaObject} parent - The parent of the processed object
30
+ * @argument {string} parentPropName - The prop name of the parent object whose value was processed
31
+ */
32
+ onBundle?(path: string, value: JSONSchemaObject, parent?: JSONSchemaObject, parentPropName?: string): void;
33
+ }
34
+
15
35
  export interface DereferenceOptions {
16
36
  /**
17
37
  * Determines whether circular `$ref` pointers are handled.
@@ -107,6 +127,11 @@ export interface $RefParserOptions<S extends object = JSONSchema> {
107
127
  */
108
128
  continueOnError: boolean;
109
129
 
130
+ /**
131
+ * The `bundle` options control how JSON Schema `$Ref` Parser will process `$ref` pointers within the JSON schema.
132
+ */
133
+ bundle: BundleOptions;
134
+
110
135
  /**
111
136
  * The `dereference` options control how JSON Schema `$Ref` Parser will dereference `$ref` pointers within the JSON schema.
112
137
  */
@@ -168,6 +193,20 @@ export const getJsonSchemaRefParserDefaultOptions = () => {
168
193
  */
169
194
  continueOnError: false,
170
195
 
196
+ /**
197
+ * Determines the types of JSON references that are allowed.
198
+ */
199
+ bundle: {
200
+ /**
201
+ * A function, called for each path, which can return true to stop this path and all
202
+ * subpaths from being processed further. This is useful in schemas where some
203
+ * subpaths contain literal $ref keys that should not be changed.
204
+ *
205
+ * @type {function}
206
+ */
207
+ excludedPathMatcher: () => false,
208
+ },
209
+
171
210
  /**
172
211
  * Determines the types of JSON references that are allowed.
173
212
  */
@@ -108,7 +108,7 @@ export async function run<S extends object = JSONSchema, O extends ParserOptions
108
108
  // console.log(' success');
109
109
  resolve({
110
110
  plugin,
111
- result,
111
+ result: result!,
112
112
  });
113
113
  }
114
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apidevtools/json-schema-ref-parser",
3
- "version": "14.0.2",
3
+ "version": "14.1.0",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -59,36 +59,35 @@
59
59
  "fs": false
60
60
  },
61
61
  "engines": {
62
- "node": ">= 16"
62
+ "node": ">= 20"
63
63
  },
64
64
  "files": [
65
65
  "lib",
66
- "dist",
67
- "cjs"
66
+ "dist"
68
67
  ],
69
68
  "devDependencies": {
70
- "@eslint/compat": "^1.3.0",
71
- "@eslint/js": "^9.29.0",
69
+ "@eslint/compat": "^1.3.1",
70
+ "@eslint/js": "^9.30.0",
72
71
  "@types/eslint": "^9.6.1",
73
72
  "@types/js-yaml": "^4.0.9",
74
73
  "@types/node": "^24",
75
- "@typescript-eslint/eslint-plugin": "^8.34.1",
76
- "@typescript-eslint/parser": "^8.34.1",
74
+ "@typescript-eslint/eslint-plugin": "^8.35.1",
75
+ "@typescript-eslint/parser": "^8.35.1",
77
76
  "@vitest/coverage-v8": "^3.2.4",
78
77
  "cross-env": "^7.0.3",
79
- "eslint": "^9.29.0",
78
+ "eslint": "^9.30.0",
80
79
  "eslint-config-prettier": "^10.1.5",
81
80
  "eslint-config-standard": "^17.1.0",
82
- "eslint-plugin-import": "^2.31.0",
83
- "eslint-plugin-prettier": "^5.5.0",
81
+ "eslint-plugin-import": "^2.32.0",
82
+ "eslint-plugin-prettier": "^5.5.1",
84
83
  "eslint-plugin-promise": "^7.2.1",
85
84
  "eslint-plugin-unused-imports": "^4.1.4",
86
85
  "globals": "^16.2.0",
87
86
  "jsdom": "^26.1.0",
88
- "prettier": "^3.5.3",
87
+ "prettier": "^3.6.2",
89
88
  "rimraf": "^6.0.1",
90
89
  "typescript": "^5.8.3",
91
- "typescript-eslint": "^8.34.1",
90
+ "typescript-eslint": "^8.35.1",
92
91
  "vitest": "^3.2.4"
93
92
  },
94
93
  "dependencies": {
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("vitest/config");
4
- const isBrowser = process.env.BROWSER === "true";
5
- exports.default = (0, config_1.defineConfig)({
6
- test: {
7
- environment: isBrowser ? "jsdom" : "node",
8
- dir: "test",
9
- exclude: ["**/__IGNORED__/**"],
10
- watch: false,
11
- globalSetup: isBrowser ? ["./test/fixtures/server.ts"] : undefined,
12
- testTimeout: 5000,
13
- globals: true,
14
- passWithNoTests: true,
15
- reporters: ["verbose"],
16
- coverage: { reporter: ["lcov", "html", "text"] },
17
- snapshotSerializers: ["./test/utils/serializeJson.ts"],
18
- },
19
- });