msw 2.2.13 → 2.2.14
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.
- package/lib/browser/index.js +7 -7
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +7 -7
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{GraphQLHandler-bom2Dn82.d.ts → GraphQLHandler-COiPfZ8k.d.ts} +1 -1
- package/lib/core/{GraphQLHandler-yJ_I6j54.d.mts → GraphQLHandler-Dq_WRbKe.d.mts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/SetupApi.d.mts +1 -1
- package/lib/core/SetupApi.d.ts +1 -1
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +2 -2
- package/lib/core/graphql.d.ts +2 -2
- package/lib/core/handlers/GraphQLHandler.d.mts +2 -2
- package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
- package/lib/core/handlers/HttpHandler.d.mts +1 -1
- package/lib/core/handlers/HttpHandler.d.ts +1 -1
- package/lib/core/handlers/RequestHandler.d.mts +1 -1
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/index.d.mts +2 -2
- package/lib/core/index.d.ts +2 -2
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/executeHandlers.d.mts +1 -1
- package/lib/core/utils/executeHandlers.d.ts +1 -1
- package/lib/core/utils/handleRequest.d.mts +1 -1
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +2 -2
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
- package/lib/core/utils/request/onUnhandledRequest.js +1 -1
- package/lib/core/utils/request/onUnhandledRequest.js.map +1 -1
- package/lib/core/utils/request/onUnhandledRequest.mjs +1 -1
- package/lib/core/utils/request/onUnhandledRequest.mjs.map +1 -1
- package/lib/iife/index.js +13 -11
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +17 -5
- package/src/core/utils/request/onUnhandledRequest.test.ts +30 -4
- package/src/core/utils/request/onUnhandledRequest.ts +1 -1
- /package/lib/core/{HttpResponse-vQNlixkj.d.ts → HttpResponse-B07UKAkU.d.ts} +0 -0
- /package/lib/core/{HttpResponse-3-NyzyF7.d.mts → HttpResponse-C7niBMwb.d.mts} +0 -0
package/lib/mockServiceWorker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.2.
|
|
11
|
+
const PACKAGE_VERSION = '2.2.14'
|
|
12
12
|
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.14",
|
|
4
4
|
"description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
|
|
5
5
|
"main": "./lib/core/index.js",
|
|
6
6
|
"module": "./lib/core/index.mjs",
|
|
7
7
|
"types": "./lib/core/index.d.ts",
|
|
8
|
-
"packageManager": "pnpm@
|
|
8
|
+
"packageManager": "pnpm@8.15.6",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./lib/core/index.d.ts",
|
|
@@ -14,22 +14,34 @@
|
|
|
14
14
|
"default": "./lib/core/index.js"
|
|
15
15
|
},
|
|
16
16
|
"./browser": {
|
|
17
|
-
"node": null,
|
|
18
17
|
"types": "./lib/browser/index.d.ts",
|
|
18
|
+
"browser": {
|
|
19
|
+
"require": "./lib/browser/index.js",
|
|
20
|
+
"import": "./lib/browser/index.mjs"
|
|
21
|
+
},
|
|
22
|
+
"node": null,
|
|
19
23
|
"require": "./lib/browser/index.js",
|
|
20
24
|
"import": "./lib/browser/index.mjs",
|
|
21
25
|
"default": "./lib/browser/index.js"
|
|
22
26
|
},
|
|
23
27
|
"./node": {
|
|
24
|
-
"browser": null,
|
|
25
28
|
"types": "./lib/node/index.d.ts",
|
|
29
|
+
"node": {
|
|
30
|
+
"require": "./lib/node/index.js",
|
|
31
|
+
"import": "./lib/node/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"browser": null,
|
|
26
34
|
"require": "./lib/node/index.js",
|
|
27
35
|
"import": "./lib/node/index.mjs",
|
|
28
36
|
"default": "./lib/node/index.mjs"
|
|
29
37
|
},
|
|
30
38
|
"./native": {
|
|
31
|
-
"browser": null,
|
|
32
39
|
"types": "./lib/native/index.d.ts",
|
|
40
|
+
"react-native": {
|
|
41
|
+
"require": "./lib/native/index.js",
|
|
42
|
+
"import": "./lib/native/index.mjs"
|
|
43
|
+
},
|
|
44
|
+
"browser": null,
|
|
33
45
|
"require": "./lib/native/index.js",
|
|
34
46
|
"import": "./lib/native/index.mjs",
|
|
35
47
|
"default": "./lib/native/index.js"
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from './onUnhandledRequest'
|
|
8
8
|
|
|
9
9
|
const fixtures = {
|
|
10
|
-
warningWithoutSuggestions: `\
|
|
10
|
+
warningWithoutSuggestions: (url = `/api`) => `\
|
|
11
11
|
[MSW] Warning: intercepted a request without a matching request handler:
|
|
12
12
|
|
|
13
|
-
• GET
|
|
13
|
+
• GET ${url}
|
|
14
14
|
|
|
15
15
|
If you still wish to intercept this unhandled request, please create a request handler for it.
|
|
16
16
|
Read more: https://mswjs.io/docs/getting-started/mocks`,
|
|
@@ -46,7 +46,9 @@ test('supports the "bypass" request strategy', async () => {
|
|
|
46
46
|
test('supports the "warn" request strategy', async () => {
|
|
47
47
|
await onUnhandledRequest(new Request(new URL('http://localhost/api')), 'warn')
|
|
48
48
|
|
|
49
|
-
expect(console.warn).toHaveBeenCalledWith(
|
|
49
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
50
|
+
fixtures.warningWithoutSuggestions(),
|
|
51
|
+
)
|
|
50
52
|
})
|
|
51
53
|
|
|
52
54
|
test('supports the "error" request strategy', async () => {
|
|
@@ -103,7 +105,9 @@ test('supports calling default strategies from the custom callback function', as
|
|
|
103
105
|
test('does not print any suggestions given no handlers to suggest', async () => {
|
|
104
106
|
await onUnhandledRequest(new Request(new URL('http://localhost/api')), 'warn')
|
|
105
107
|
|
|
106
|
-
expect(console.warn).toHaveBeenCalledWith(
|
|
108
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
109
|
+
fixtures.warningWithoutSuggestions(),
|
|
110
|
+
)
|
|
107
111
|
})
|
|
108
112
|
|
|
109
113
|
test('throws an exception given unknown request strategy', async () => {
|
|
@@ -117,3 +121,25 @@ test('throws an exception given unknown request strategy', async () => {
|
|
|
117
121
|
'[MSW] Failed to react to an unhandled request: unknown strategy "invalid-strategy". Please provide one of the supported strategies ("bypass", "warn", "error") or a custom callback function as the value of the "onUnhandledRequest" option.',
|
|
118
122
|
)
|
|
119
123
|
})
|
|
124
|
+
|
|
125
|
+
test('prints with a relative URL and search params', async () => {
|
|
126
|
+
await onUnhandledRequest(
|
|
127
|
+
new Request(new URL('http://localhost/api?foo=boo')),
|
|
128
|
+
'warn',
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
132
|
+
fixtures.warningWithoutSuggestions(`/api?foo=boo`),
|
|
133
|
+
)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('prints with an absolute URL and search params', async () => {
|
|
137
|
+
await onUnhandledRequest(
|
|
138
|
+
new Request(new URL('https://mswjs.io/api?foo=boo')),
|
|
139
|
+
'warn',
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
expect(console.warn).toHaveBeenCalledWith(
|
|
143
|
+
fixtures.warningWithoutSuggestions(`https://mswjs.io/api?foo=boo`),
|
|
144
|
+
)
|
|
145
|
+
})
|
|
@@ -22,7 +22,7 @@ export async function onUnhandledRequest(
|
|
|
22
22
|
strategy: UnhandledRequestStrategy = 'warn',
|
|
23
23
|
): Promise<void> {
|
|
24
24
|
const url = new URL(request.url)
|
|
25
|
-
const publicUrl = toPublicUrl(url)
|
|
25
|
+
const publicUrl = toPublicUrl(url) + url.search
|
|
26
26
|
|
|
27
27
|
const unhandledRequestMessage = `intercepted a request without a matching request handler:\n\n \u2022 ${request.method} ${publicUrl}\n\nIf you still wish to intercept this unhandled request, please create a request handler for it.\nRead more: https://mswjs.io/docs/getting-started/mocks`
|
|
28
28
|
|
|
File without changes
|
|
File without changes
|