Skip to content

Commit dff9c33

Browse files
committed
release: next-test-api-route-handler@5.0.3 [skip ci]
## ⚡️ Optimizations - Use Node's ReadableStream.from instead of ponyfill ([6f32402][2]) [1]: https://github.com/Xunnamius/next-test-api-route-handler/compare/next-test-api-route-handler@5.0.2...next-test-api-route-handler@5.0.3 [2]: 6f32402
1 parent 7680aa4 commit dff9c33

20 files changed

+415
-507
lines changed

CHANGELOG.md

Lines changed: 380 additions & 428 deletions
Large diffs are not rendered by default.

docs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@
77
## Modules
88

99
- [src](src/README.md)
10-
- [test/integration/integration-smoke-external.ignore](test/integration/integration-smoke-external.ignore/README.md)
1110
- [test/setup](test/setup/README.md)
12-
- [test/unit-external.ignore](test/unit-external.ignore/README.md)
1311
- [test/util](test/util/README.md)

docs/src/functions/testApiHandler.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> **testApiHandler**\<`NextResponseJsonType`\>(`__namedParameters`): `Promise`\<`void`\>
1010
11-
Defined in: [src/index.ts:310](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L310)
11+
Defined in: [src/index.ts:311](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L311)
1212

1313
Uses Next's internal `apiResolver` (for Pages Router) or an
1414
`AppRouteRouteModule` instance (for App Router) to execute api route handlers

docs/src/interfaces/NtarhInit.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Interface: NtarhInit\<NextResponseJsonType\>
88

9-
Defined in: [src/index.ts:144](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L144)
9+
Defined in: [src/index.ts:145](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L145)
1010

1111
## Extended by
1212

@@ -25,7 +25,7 @@ Defined in: [src/index.ts:144](https://github.com/Xunnamius/next-test-api-route-
2525

2626
> `optional` **rejectOnHandlerError**: `boolean`
2727
28-
Defined in: [src/index.ts:157](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L157)
28+
Defined in: [src/index.ts:158](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L158)
2929

3030
If `false`, errors thrown from within a handler are kicked up to Next.js's
3131
resolver to deal with, which is what would happen in production. If `true`,
@@ -48,7 +48,7 @@ false
4848

4949
> **test**: (`parameters`) => `Promisable`\<`void`\>
5050
51-
Defined in: [src/index.ts:163](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L163)
51+
Defined in: [src/index.ts:164](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L164)
5252

5353
`test` is a function that runs your test assertions. This function receives
5454
one destructured parameter: `fetch`, which is equivalent to

docs/src/interfaces/NtarhInitAppRouter.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Interface: NtarhInitAppRouter\<NextResponseJsonType\>
88

9-
Defined in: [src/index.ts:174](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L174)
9+
Defined in: [src/index.ts:175](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L175)
1010

1111
The parameters expected by `testApiHandler` when using `appHandler`.
1212

@@ -26,7 +26,7 @@ The parameters expected by `testApiHandler` when using `appHandler`.
2626

2727
> **appHandler**: `Partial`\<`Omit`\<`AppRouteUserlandModule`, keyof `AppRouteHandlers`\> & `{ [key in keyof AppRouteHandlers]?: (req: NextRequest, segmentData?: any) => any }`\>
2828
29-
Defined in: [src/index.ts:183](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L183)
29+
Defined in: [src/index.ts:184](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L184)
3030

3131
The actual App Router route handler under test. It should be an object
3232
containing one or more async functions named for valid HTTP methods and/or
@@ -40,15 +40,15 @@ for details.
4040

4141
> `optional` **pagesHandler**: `undefined`
4242
43-
Defined in: [src/index.ts:194](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L194)
43+
Defined in: [src/index.ts:195](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L195)
4444

4545
***
4646

4747
### params?
4848

4949
> `optional` **params**: `Record`\<`string`, `string` \| `string`[]\>
5050
51-
Defined in: [src/index.ts:204](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L204)
51+
Defined in: [src/index.ts:205](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L205)
5252

5353
`params` is passed directly to the handler and represents processed dynamic
5454
routes. This should not be confused with query string parsing, which is
@@ -64,7 +64,7 @@ once.
6464

6565
> `optional` **paramsPatcher**: (`params`) => `Promisable`\<`void` \| `Record`\<`string`, `string` \| `string`[]\>\>
6666
67-
Defined in: [src/index.ts:214](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L214)
67+
Defined in: [src/index.ts:215](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L215)
6868

6969
A function that receives `params`, an object representing "processed"
7070
dynamic route parameters. Modifications to `params` are passed directly to
@@ -90,7 +90,7 @@ is handled by `Request` automatically.
9090

9191
> `optional` **rejectOnHandlerError**: `boolean`
9292
93-
Defined in: [src/index.ts:157](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L157)
93+
Defined in: [src/index.ts:158](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L158)
9494

9595
If `false`, errors thrown from within a handler are kicked up to Next.js's
9696
resolver to deal with, which is what would happen in production. If `true`,
@@ -117,7 +117,7 @@ false
117117

118118
> `optional` **requestPatcher**: (`request`) => `Promisable`\<`void` \| `Request`\>
119119
120-
Defined in: [src/index.ts:226](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L226)
120+
Defined in: [src/index.ts:227](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L227)
121121

122122
A function that receives a `NextRequest` object and returns a `Request`
123123
instance. Use this function to edit the request _before_ it's injected
@@ -143,7 +143,7 @@ NextRequest(returnedRequest, { ... })`.
143143

144144
> `optional` **responsePatcher**: (`res`) => `Promisable`\<`void` \| `Response`\>
145145
146-
Defined in: [src/index.ts:239](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L239)
146+
Defined in: [src/index.ts:240](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L240)
147147

148148
A function that receives the `Response` object returned from `appHandler`
149149
and returns a `Response` instance. Use this function to edit the response
@@ -170,7 +170,7 @@ unhandled exception occurs _and_ `rejectOnHandlerError` is `true`.
170170

171171
> **test**: (`parameters`) => `Promisable`\<`void`\>
172172
173-
Defined in: [src/index.ts:163](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L163)
173+
Defined in: [src/index.ts:164](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L164)
174174

175175
`test` is a function that runs your test assertions. This function receives
176176
one destructured parameter: `fetch`, which is equivalent to
@@ -198,7 +198,7 @@ one destructured parameter: `fetch`, which is equivalent to
198198

199199
> `optional` **url**: `string`
200200
201-
Defined in: [src/index.ts:244](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L244)
201+
Defined in: [src/index.ts:245](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L245)
202202

203203
`url: 'your-url'` is shorthand for `requestPatcher: (request) => new
204204
NextRequest('your-url', request)`

docs/src/interfaces/NtarhInitPagesRouter.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Interface: NtarhInitPagesRouter\<NextResponseJsonType\>
88

9-
Defined in: [src/index.ts:250](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L250)
9+
Defined in: [src/index.ts:251](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L251)
1010

1111
The parameters expected by `testApiHandler` when using `pagesHandler`.
1212

@@ -26,15 +26,15 @@ The parameters expected by `testApiHandler` when using `pagesHandler`.
2626

2727
> `optional` **appHandler**: `undefined`
2828
29-
Defined in: [src/index.ts:262](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L262)
29+
Defined in: [src/index.ts:263](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L263)
3030

3131
***
3232

3333
### pagesHandler
3434

3535
> **pagesHandler**: `NextApiHandler` \| \{ `default`: `NextApiHandler`; \}
3636
37-
Defined in: [src/index.ts:261](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L261)
37+
Defined in: [src/index.ts:262](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L262)
3838

3939
The actual Pages Router route handler under test. It should be an async
4040
function that accepts `NextApiRequest` and `NextApiResult` objects (in
@@ -50,7 +50,7 @@ will have a typed result.
5050

5151
> `optional` **params**: `Record`\<`string`, `unknown`\>
5252
53-
Defined in: [src/index.ts:272](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L272)
53+
Defined in: [src/index.ts:273](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L273)
5454

5555
`params` is passed directly to the handler and represents processed dynamic
5656
routes. This should not be confused with query string parsing, which is
@@ -66,7 +66,7 @@ once.
6666

6767
> `optional` **paramsPatcher**: (`params`) => `Promisable`\<`void` \| `Record`\<`string`, `unknown`\>\>
6868
69-
Defined in: [src/index.ts:282](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L282)
69+
Defined in: [src/index.ts:283](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L283)
7070

7171
A function that receives `params`, an object representing "processed"
7272
dynamic route parameters. Modifications to `params` are passed directly to
@@ -92,7 +92,7 @@ is handled automatically.
9292

9393
> `optional` **rejectOnHandlerError**: `boolean`
9494
95-
Defined in: [src/index.ts:157](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L157)
95+
Defined in: [src/index.ts:158](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L158)
9696

9797
If `false`, errors thrown from within a handler are kicked up to Next.js's
9898
resolver to deal with, which is what would happen in production. If `true`,
@@ -119,7 +119,7 @@ false
119119

120120
> `optional` **requestPatcher**: (`request`) => `Promisable`\<`void`\>
121121
122-
Defined in: [src/index.ts:292](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L292)
122+
Defined in: [src/index.ts:293](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L293)
123123

124124
A function that receives an `IncomingMessage` object. Use this function
125125
to edit the request _before_ it's injected into the handler.
@@ -143,7 +143,7 @@ lowercase.**
143143

144144
> `optional` **responsePatcher**: (`res`) => `Promisable`\<`void`\>
145145
146-
Defined in: [src/index.ts:297](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L297)
146+
Defined in: [src/index.ts:298](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L298)
147147

148148
A function that receives a `ServerResponse` object. Use this function
149149
to edit the response _before_ it's injected into the handler.
@@ -164,7 +164,7 @@ to edit the response _before_ it's injected into the handler.
164164

165165
> **test**: (`parameters`) => `Promisable`\<`void`\>
166166
167-
Defined in: [src/index.ts:163](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L163)
167+
Defined in: [src/index.ts:164](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L164)
168168

169169
`test` is a function that runs your test assertions. This function receives
170170
one destructured parameter: `fetch`, which is equivalent to
@@ -192,7 +192,7 @@ one destructured parameter: `fetch`, which is equivalent to
192192

193193
> `optional` **url**: `string`
194194
195-
Defined in: [src/index.ts:302](https://github.com/Xunnamius/next-test-api-route-handler/blob/fc0972ebac2c7f073379ab76e95e9fc328afef50/src/index.ts#L302)
195+
Defined in: [src/index.ts:303](https://github.com/Xunnamius/next-test-api-route-handler/blob/7680aa4482550d5e81f4eff590b7532434ed2196/src/index.ts#L303)
196196

197197
`url: 'your-url'` is shorthand for `requestPatcher: (req) => { req.url =
198198
'your-url' }`

docs/test/integration/integration-smoke-external.ignore/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/test/unit-external.ignore/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/test/util/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
- [dummyNpmPackageFixture](functions/dummyNpmPackageFixture.md)
8989
- [ensurePackageHasBeenBuilt](functions/ensurePackageHasBeenBuilt.md)
9090
- [expectExceptionsWithMatchingErrors](functions/expectExceptionsWithMatchingErrors.md)
91-
- [getNextjsReactPeerDependencies](functions/getNextjsReactPeerDependencies.md)
9291
- [gitRepositoryFixture](functions/gitRepositoryFixture.md)
9392
- [isolatedImport](functions/isolatedImport.md)
9493
- [mockArgvFactory](functions/mockArgvFactory.md)

docs/test/util/functions/getNextjsReactPeerDependencies.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)