msw 0.33.3 → 0.34.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.
@@ -2,13 +2,13 @@
2
2
  /* tslint:disable */
3
3
 
4
4
  /**
5
- * Mock Service Worker (0.33.3).
5
+ * Mock Service Worker (0.34.0).
6
6
  * @see https://github.com/mswjs/msw
7
7
  * - Please do NOT modify this file.
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const INTEGRITY_CHECKSUM = 'a615cd395ea10f948a628bce3857a385'
11
+ const INTEGRITY_CHECKSUM = 'f0a916b13c8acc2b526a03a6d26df85f'
12
12
  const bypassHeaderName = 'x-msw-bypass'
13
13
  const activeClientIds = new Set()
14
14
 
@@ -221,13 +221,11 @@ async function getResponse(event, client, requestId) {
221
221
 
222
222
  console.error(
223
223
  `\
224
- [MSW] Request handler function for "%s %s" has thrown the following exception:
224
+ [MSW] Uncaught exception in the request handler for "%s %s":
225
225
 
226
- ${parsedBody.errorType}: ${parsedBody.message}
227
- (see more detailed error stack trace in the mocked response body)
226
+ ${parsedBody.location}
228
227
 
229
- This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error.
230
- If you wish to mock an error response, please refer to this guide: https://mswjs.io/docs/recipes/mocking-error-responses\
228
+ This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/recipes/mocking-error-responses\
231
229
  `,
232
230
  request.method,
233
231
  request.url,
@@ -271,11 +269,22 @@ self.addEventListener('fetch', function (event) {
271
269
 
272
270
  return event.respondWith(
273
271
  handleRequest(event, requestId).catch((error) => {
272
+ if (error.name === 'NetworkError') {
273
+ console.warn(
274
+ '[MSW] Successfully emulated a network error for the "%s %s" request.',
275
+ request.method,
276
+ request.url,
277
+ )
278
+ return
279
+ }
280
+
281
+ // At this point, any exception indicates an issue with the original request/response.
274
282
  console.error(
275
- '[MSW] Failed to mock a "%s" request to "%s": %s',
283
+ `\
284
+ [MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`,
276
285
  request.method,
277
286
  request.url,
278
- error,
287
+ `${error.name}: ${error.message}`,
279
288
  )
280
289
  }),
281
290
  )
@@ -2228,6 +2228,7 @@ function invariant(condition, message) {
2228
2228
 
2229
2229
  // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
2230
2230
  var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;
2231
+ var nodejsCustomInspectSymbol$1 = nodejsCustomInspectSymbol;
2231
2232
 
2232
2233
  /**
2233
2234
  * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`
@@ -2238,8 +2239,8 @@ function defineInspect(classObject) {
2238
2239
  typeof fn === 'function' || invariant(0);
2239
2240
  classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')
2240
2241
 
2241
- if (nodejsCustomInspectSymbol) {
2242
- classObject.prototype[nodejsCustomInspectSymbol] = fn;
2242
+ if (nodejsCustomInspectSymbol$1) {
2243
+ classObject.prototype[nodejsCustomInspectSymbol$1] = fn;
2243
2244
  }
2244
2245
  }
2245
2246
 
@@ -2482,7 +2483,7 @@ function formatArray(array, seenValues) {
2482
2483
  }
2483
2484
 
2484
2485
  function getCustomFn(object) {
2485
- var customInspectFn = object[String(nodejsCustomInspectSymbol)];
2486
+ var customInspectFn = object[String(nodejsCustomInspectSymbol$1)];
2486
2487
 
2487
2488
  if (typeof customInspectFn === 'function') {
2488
2489
  return customInspectFn;
package/node/lib/index.js CHANGED
@@ -4114,6 +4114,7 @@ function invariant(condition, message) {
4114
4114
 
4115
4115
  // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
4116
4116
  var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;
4117
+ var nodejsCustomInspectSymbol$1 = nodejsCustomInspectSymbol;
4117
4118
 
4118
4119
  /**
4119
4120
  * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`
@@ -4124,8 +4125,8 @@ function defineInspect(classObject) {
4124
4125
  typeof fn === 'function' || invariant(0);
4125
4126
  classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')
4126
4127
 
4127
- if (nodejsCustomInspectSymbol) {
4128
- classObject.prototype[nodejsCustomInspectSymbol] = fn;
4128
+ if (nodejsCustomInspectSymbol$1) {
4129
+ classObject.prototype[nodejsCustomInspectSymbol$1] = fn;
4129
4130
  }
4130
4131
  }
4131
4132
 
@@ -4368,7 +4369,7 @@ function formatArray(array, seenValues) {
4368
4369
  }
4369
4370
 
4370
4371
  function getCustomFn(object) {
4371
- var customInspectFn = object[String(nodejsCustomInspectSymbol)];
4372
+ var customInspectFn = object[String(nodejsCustomInspectSymbol$1)];
4372
4373
 
4373
4374
  if (typeof customInspectFn === 'function') {
4374
4375
  return customInspectFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "msw",
3
- "version": "0.33.3",
3
+ "version": "0.34.0",
4
4
  "description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
5
5
  "main": "lib/umd/index.js",
6
6
  "module": "lib/esm/index.js",