Skip to content

Commit

Permalink
release: 4.0.9 [skip ci]
Browse files Browse the repository at this point in the history
### [4.0.9](v4.0.8...v4.0.9) (2024-09-13)

#### 🪄 Fixes

* **src:** prevent ipv6-related failures due to assuming "localhost" resolvability ([99118a6](99118a6)) <sup>closes [#1068](https://github.com/Xunnamius/next-test-api-route-handler/issues/1068)</sup>

#### ⚙️ Build system

* **externals:** update is-next-compat to work with Octokit's new esm exports ([50d2976](50d2976))
* **husky:** update husky scripts ([88948b6](88948b6))
* **package:** downgrade @octokit/rest to 20 ([fa4b2af](fa4b2af))
* Remove spellchecker dependency ([b0701a2](b0701a2))
  • Loading branch information
Xunnamius committed Sep 13, 2024
1 parent 09aebe6 commit 945857b
Show file tree
Hide file tree
Showing 9 changed files with 606 additions and 584 deletions.
1,066 changes: 543 additions & 523 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/functions/testApiHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Uses Next's internal `apiResolver` (for Pages Router) or an
`AppRouteRouteModule` instance (for App Router) to execute api route handlers
in a Next-like testing environment.

## Type parameters
## Type Parameters

**NextResponseJsonType** = `any`

Expand All @@ -24,6 +24,6 @@ in a Next-like testing environment.

`Promise`\<`void`\>

## Source
## Defined in

[index.ts:273](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L273)
[index.ts:273](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L273)
12 changes: 7 additions & 5 deletions docs/interfaces/NtarhInit.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

# Interface: NtarhInit\<NextResponseJsonType\>

**`Internal`**

## Extended by

- [`NtarhInitAppRouter`](NtarhInitAppRouter.md)
- [`NtarhInitPagesRouter`](NtarhInitPagesRouter.md)

## Type parameters
## Type Parameters

**NextResponseJsonType** = `unknown`

Expand All @@ -36,9 +38,9 @@ negative despite exceptions being thrown.
false
```

#### Source
#### Defined in

[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L123)
[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L123)

***

Expand All @@ -60,6 +62,6 @@ one destructured parameter: `fetch`, which is equivalent to

[`Promisable`](../type-aliases/Promisable.md)\<`void`\>

#### Source
#### Defined in

[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L129)
[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L129)
38 changes: 19 additions & 19 deletions docs/interfaces/NtarhInitAppRouter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The parameters expected by `testApiHandler` when using `appHandler`.

- [`NtarhInit`](NtarhInit.md)\<`NextResponseJsonType`\>

## Type parameters
## Type Parameters

**NextResponseJsonType** = `unknown`

Expand Down Expand Up @@ -58,19 +58,19 @@ for details.

> **PUT**: `undefined` \| (`req`, `context`?) => `any`
#### Source
#### Defined in

[index.ts:146](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L146)
[index.ts:146](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L146)

***

### pagesHandler?

> `optional` **pagesHandler**: `undefined`
#### Source
#### Defined in

[index.ts:155](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L155)
[index.ts:155](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L155)

***

Expand All @@ -86,9 +86,9 @@ handled by `Request` automatically.
params.id = 'some-id' }`. This is useful for quickly setting many params at
once.

#### Source
#### Defined in

[index.ts:165](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L165)
[index.ts:165](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L165)

***

Expand All @@ -112,9 +112,9 @@ is handled by `Request` automatically.

[`Promisable`](../type-aliases/Promisable.md)\<`void` \| `Record`\<`string`, `string` \| `string`[]\>\>

#### Source
#### Defined in

[index.ts:175](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L175)
[index.ts:175](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L175)

***

Expand All @@ -141,9 +141,9 @@ false

[`NtarhInit`](NtarhInit.md).[`rejectOnHandlerError`](NtarhInit.md#rejectonhandlererror)

#### Source
#### Defined in

[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L123)
[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L123)

***

Expand All @@ -167,9 +167,9 @@ NextRequest(returnedRequest, { ... })`.

[`Promisable`](../type-aliases/Promisable.md)\<`void` \| `Request`\>

#### Source
#### Defined in

[index.ts:188](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L188)
[index.ts:188](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L188)

***

Expand All @@ -194,9 +194,9 @@ unhandled exception occurs _and_ `rejectOnHandlerError` is `true`.

[`Promisable`](../type-aliases/Promisable.md)\<`void` \| `Response`\>

#### Source
#### Defined in

[index.ts:201](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L201)
[index.ts:201](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L201)

***

Expand All @@ -222,9 +222,9 @@ one destructured parameter: `fetch`, which is equivalent to

[`NtarhInit`](NtarhInit.md).[`test`](NtarhInit.md#test)

#### Source
#### Defined in

[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L129)
[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L129)

***

Expand All @@ -235,6 +235,6 @@ one destructured parameter: `fetch`, which is equivalent to
`url: 'your-url'` is shorthand for `requestPatcher: (request) => new
NextRequest('your-url', request)`

#### Source
#### Defined in

[index.ts:206](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L206)
[index.ts:206](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L206)
38 changes: 19 additions & 19 deletions docs/interfaces/NtarhInitPagesRouter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The parameters expected by `testApiHandler` when using `pagesHandler`.

- [`NtarhInit`](NtarhInit.md)\<`NextResponseJsonType`\>

## Type parameters
## Type Parameters

**NextResponseJsonType** = `unknown`

Expand All @@ -22,9 +22,9 @@ The parameters expected by `testApiHandler` when using `pagesHandler`.

> `optional` **appHandler**: `undefined`
#### Source
#### Defined in

[index.ts:224](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L224)
[index.ts:224](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L224)

***

Expand All @@ -40,9 +40,9 @@ Note that type checking for `res.send` and similar methods was retired in
NTARH@4. Only the `response.json` method returned by NTARH's fetch wrapper
will have a typed result.

#### Source
#### Defined in

[index.ts:223](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L223)
[index.ts:223](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L223)

***

Expand All @@ -58,9 +58,9 @@ handled automatically.
params.id = 'some-id' }`. This is useful for quickly setting many params at
once.

#### Source
#### Defined in

[index.ts:234](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L234)
[index.ts:234](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L234)

***

Expand All @@ -84,9 +84,9 @@ is handled automatically.

[`Promisable`](../type-aliases/Promisable.md)\<`void` \| `Record`\<`string`, `unknown`\>\>

#### Source
#### Defined in

[index.ts:244](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L244)
[index.ts:244](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L244)

***

Expand All @@ -113,9 +113,9 @@ false

[`NtarhInit`](NtarhInit.md).[`rejectOnHandlerError`](NtarhInit.md#rejectonhandlererror)

#### Source
#### Defined in

[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L123)
[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L123)

***

Expand All @@ -137,9 +137,9 @@ lowercase.**

[`Promisable`](../type-aliases/Promisable.md)\<`void`\>

#### Source
#### Defined in

[index.ts:255](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L255)
[index.ts:255](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L255)

***

Expand All @@ -158,9 +158,9 @@ to edit the response _before_ it's injected into the handler.

[`Promisable`](../type-aliases/Promisable.md)\<`void`\>

#### Source
#### Defined in

[index.ts:260](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L260)
[index.ts:260](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L260)

***

Expand All @@ -186,9 +186,9 @@ one destructured parameter: `fetch`, which is equivalent to

[`NtarhInit`](NtarhInit.md).[`test`](NtarhInit.md#test)

#### Source
#### Defined in

[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L129)
[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L129)

***

Expand All @@ -199,6 +199,6 @@ one destructured parameter: `fetch`, which is equivalent to
`url: 'your-url'` is shorthand for `requestPatcher: (req) => { req.url =
'your-url' }`

#### Source
#### Defined in

[index.ts:265](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L265)
[index.ts:265](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L265)
12 changes: 6 additions & 6 deletions docs/type-aliases/FetchReturnType.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

[next-test-api-route-handler](../README.md) / FetchReturnType

# Type alias: FetchReturnType\<NextResponseJsonType\>

`Internal`
# Type Alias: FetchReturnType\<NextResponseJsonType\>

> **FetchReturnType**\<`NextResponseJsonType`\>: `Promise`\<`Omit`\<`Response`, `"json"`\> & `object`\>
## Type parameters
**`Internal`**

## Type Parameters

**NextResponseJsonType**

## Source
## Defined in

[index.ts:100](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L100)
[index.ts:100](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L100)
12 changes: 6 additions & 6 deletions docs/type-aliases/Promisable.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

[next-test-api-route-handler](../README.md) / Promisable

# Type alias: Promisable\<Promised\>

`Internal`
# Type Alias: Promisable\<Promised\>

> **Promisable**\<`Promised`\>: `Promised` \| `Promise`\<`Promised`\>
## Type parameters
**`Internal`**

## Type Parameters

**Promised**

## Source
## Defined in

[index.ts:95](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L95)
[index.ts:95](https://github.com/Xunnamius/next-test-api-route-handler/blob/89d2409a8fbc9ba840b27d51fe118ce111e6c10f/src/index.ts#L95)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-test-api-route-handler",
"version": "4.0.8",
"version": "4.0.9",
"description": "Confidently unit and integration test your Next.js API routes/handlers in an isolated Next.js-like environment",
"keywords": [
"api",
Expand Down

0 comments on commit 945857b

Please sign in to comment.