Xunnamius/next-test-api-route-handler (next-test-api-route-handler)
### [`v4.0.2`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#402-3-2024-01-16)
[Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v4.0.1...v4.0.2)
##### šŖ Fixes
- **src:** add missing metadata not revealed by type information (\[[`90ff665`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/90ff665)]\[4])
- **src:** force normalization of request URLs passed to app handler (\[[`8400a19`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/8400a19)]\[5])
### [`v4.0.1`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#401-6-2024-1-16)
[Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v4.0.0...v4.0.1)
##### šŖ Fixes
- **src:** pass Next.js more accurate app route metadata (\[[`09389fe`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/09389fe)]\[7])
### [`v4.0.0`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#400-8-2024-1-15)
[Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v3.2.0...v4.0.0)
##### š„ Breaking Changes š„
- **Request URLs (e.g. `req.url`) will always be**
`"ntarh://testApiHandler"`.
This is instead of the old localhost string with the random port number, which
is an implementation detail that should not have been exposed to end developers.
- **The `handler` option of `testApiHandler` (i.e.**
`testApiHandler({ handler })`) has been renamed to `pagesHandler`. It is
otherwise functionally equivalent.
Those migrating from NTARH@<4, the process should be as simple as renaming
`handler` to `pagesHandler` in your tests and getting on with your life.
- `NtarhParameters` has been superseded by `NtarhInit`,
`NtarhInitAppRouter`, and `NtarhInitPagesRouter`.
- `requestPatcher`, `reponsePatcher`, and `paramsPatcher` options
of `testApiHandler({ ... })` can now be asynchronous and return Promises.
`paramsPatcher` can additionally return a brand new `params` object that will
overwrite the old one rather than merely augmenting it.
- `requestPatcher`, `reponsePatcher`, and `paramsPatcher` options
of `testApiHandler({ ... })` no longer support parenthetical shorthand notation.
For example, the following will cause a type error:
`testApiHandler({ paramsPatcher: (params) => (params.id = "some-id") })`.
- `testApiHandler({ ... })` now accepts the `appHandler` option.
When this option is provided, the function signatures of the following options
shift to support standard `Request`/`Response` parameters and return types where
appropriate: `requestPatcher`, `responsePatcher`, and `paramsPatcher`. See the
docs, or intellisense, for more details.
- Minimum supported Node.js version is now 18.18.2
- Node-fetch has been replaced by Node's native fetch
function. There may be subtle API changes between the two.
- The `pagesHandler` option of `testApiHandler` (i.e.
`testApiHandler({ pagesHandler })`) will **not** accept edge runtime routes. To
test your edge runtime routes, use the `appHandler` option instead.
- This version of NTARH is now actively tracking a second Next.js
internal export, one that is not guaranteed to be available before
`next@14.0.4`. Therefore, versions of Next.js older than 14.0.4 **explicitly
unsupported** when using the `appHandler` option. On the other hand,
`pagesHandler` will always work regardless of Next.js version until Vercel
eventually removes the Pages Router functionality entirely.
##### āØ Features
- Land initial App Router support (\[[`e2d8865`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/e2d8865)]\[9]) closes \[[#938](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/938)]\[10], \[[#773](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/773)]\[11]
- Retire use of node-fetch (\[[`5574831`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/5574831)]\[12]) closes \[[#946](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/946)]\[13]
- **src:** warn when invoking testApiHandler with invalid property combos (\[[`db599ac`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/db599ac)]\[14])
##### šŖ Fixes
- Loosen type checking for `NextApiHandler`s (\[[`fdfec8c`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/fdfec8c)]\[15])
- **src:** deeply summon res.json() return value into our realm (\[[`59f54a5`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/59f54a5)]\[16])
- **src:** ensure all results of calling ::json on Requests and Responses are summoned into our realm (\[[`5c5f9a4`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/5c5f9a4)]\[17])
- **src:** ensure AsyncLocalStorage is available globally (might fix \[[#875](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/875)]\[18]) (\[[`43680d9`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/43680d9)]\[19])
- **src:** ensure global fetch is restored after testApiHandler terminates (\[[`75d4e1f`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/75d4e1f)]\[20])
- **src:** forcefully coerce request.body into a ReadableStream (\[[`f715331`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/f715331)]\[21])
- **src:** hoist globalThis.AsyncLocalStorage initialization to be as soon as possible (\[[`85bb8fa`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/85bb8fa)]\[22])
- **src:** normalize pagesHandler into NextApiHandler (esm<->cjs interop) (\[[`0133e11`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/0133e11)]\[23])
- Use more accurate return type for app router patchers (\[[`62f1d0b`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/62f1d0b)]\[24])
##### āļø Build System
- **husky:** ensure hooks do not run on rebase (\[[`913cbd0`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/913cbd0)]\[25])
- **package:** bump minimum supported node versions to maintained (\[[`702cb44`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/702cb44)]\[26])
- **package:** remove outdated properties (\[[`dc23723`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/dc23723)]\[27])
##### š§šæ Refactored
- **src:** ensure request url is consistent across router types (\[[`d72ae87`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/d72ae87)]\[28])
### [`v3.2.0`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#320-3-2024-01-04)
[Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v3.1.10...v3.2.0)
##### āØ Features
- Update headers for msw@2 compatibility (\[[`93b8a3c`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/93b8a3c)]\[4]) closes \[[#916](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/916)]\[5]
##### \[3.1.10]\[6] (2023-11-04)
##### šŖ Fixes
- Ensure compat with next@12.1.0 (\[[`ca1da40`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/ca1da40)]\[7]) closes \[[#887](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/887)]\[8]
##### āļø Build System
- Add core-js polyfills and have mercy on aging node versions (\[[`a9d136b`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/a9d136b)]\[9])
- Modernize tooling (\[[`db0223e`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/db0223e)]\[10])
- Upgrade typescript-babel toolchain to nodenext (\[[`e457064`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/e457064)]\[11]) closes \[[#908](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/908)]\[12]
##### š„ Reverted
- *"docs(readme): update badge links"* (\[[`be90d57`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/be90d57)]\[13])
##### \[3.1.8]\[14] (2023-01-03)
##### āļø Build System
- **readme:** update maintainence badge and audit dependencies (\[[`2a4ae05`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/2a4ae05)]\[15])
##### \[3.1.7]\[16] (2022-07-27)
##### āļø Build System
- **package:** update dependencies (\[[`4af52f4`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/4af52f4)]\[17])
##### \[3.1.6]\[18] (2022-06-30)
##### šŖ Fixes
- Ensure non-object "headers" fetch argument is not mangled when mixing in default headers (\[[`6e94142`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/6e94142)]\[19])
##### \[3.1.5]\[20] (2022-06-26)
##### šŖ Fixes
- Fix MSW bypass override instructions and unit test (\[[`405f84d`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/405f84d)]\[21])
##### \[3.1.4]\[22] (2022-06-26)
##### āļø Build System
- **readme:** update MSW bypass override instructions under "test" entry in README (\[[`b05e112`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/b05e112)]\[23])
##### \[3.1.3]\[24] (2022-05-21)
##### āļø Build System
- **package:** update dev-dependencies (\[[`36a2c44`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/36a2c44)]\[25])
##### \[3.1.2]\[26] (2022-03-23)
##### āļø Build System
- **package:** update dependencies (\[[`065b445`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/065b445)]\[27])
##### \[3.1.1]\[28] (2022-02-18)
##### šŖ Fixes
- Ensure compat with next@12.1.0 (\[[`484d702`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/484d702)]\[29]) closes \[[#487](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/487)]\[30]
##### š„ Reverted
- *"refactor: update npm scripts, linting"* (\[[`77ad96d`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/77ad96d)]\[31])
Configuration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
^3.1.10
->^4.0.0
Release Notes
Xunnamius/next-test-api-route-handler (next-test-api-route-handler)
### [`v4.0.2`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#402-3-2024-01-16) [Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v4.0.1...v4.0.2) ##### šŖ Fixes - **src:** add missing metadata not revealed by type information (\[[`90ff665`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/90ff665)]\[4]) - **src:** force normalization of request URLs passed to app handler (\[[`8400a19`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/8400a19)]\[5]) ### [`v4.0.1`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#401-6-2024-1-16) [Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v4.0.0...v4.0.1) ##### šŖ Fixes - **src:** pass Next.js more accurate app route metadata (\[[`09389fe`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/09389fe)]\[7]) ### [`v4.0.0`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#400-8-2024-1-15) [Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v3.2.0...v4.0.0) ##### š„ Breaking Changes š„ - **Request URLs (e.g. `req.url`) will always be** `"ntarh://testApiHandler"`. This is instead of the old localhost string with the random port number, which is an implementation detail that should not have been exposed to end developers. - **The `handler` option of `testApiHandler` (i.e.** `testApiHandler({ handler })`) has been renamed to `pagesHandler`. It is otherwise functionally equivalent. Those migrating from NTARH@<4, the process should be as simple as renaming `handler` to `pagesHandler` in your tests and getting on with your life. - `NtarhParameters` has been superseded by `NtarhInit`, `NtarhInitAppRouter`, and `NtarhInitPagesRouter`. - `requestPatcher`, `reponsePatcher`, and `paramsPatcher` options of `testApiHandler({ ... })` can now be asynchronous and return Promises. `paramsPatcher` can additionally return a brand new `params` object that will overwrite the old one rather than merely augmenting it. - `requestPatcher`, `reponsePatcher`, and `paramsPatcher` options of `testApiHandler({ ... })` no longer support parenthetical shorthand notation. For example, the following will cause a type error: `testApiHandler({ paramsPatcher: (params) => (params.id = "some-id") })`. - `testApiHandler({ ... })` now accepts the `appHandler` option. When this option is provided, the function signatures of the following options shift to support standard `Request`/`Response` parameters and return types where appropriate: `requestPatcher`, `responsePatcher`, and `paramsPatcher`. See the docs, or intellisense, for more details. - Minimum supported Node.js version is now 18.18.2 - Node-fetch has been replaced by Node's native fetch function. There may be subtle API changes between the two. - The `pagesHandler` option of `testApiHandler` (i.e. `testApiHandler({ pagesHandler })`) will **not** accept edge runtime routes. To test your edge runtime routes, use the `appHandler` option instead. - This version of NTARH is now actively tracking a second Next.js internal export, one that is not guaranteed to be available before `next@14.0.4`. Therefore, versions of Next.js older than 14.0.4 **explicitly unsupported** when using the `appHandler` option. On the other hand, `pagesHandler` will always work regardless of Next.js version until Vercel eventually removes the Pages Router functionality entirely. ##### āØ Features - Land initial App Router support (\[[`e2d8865`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/e2d8865)]\[9]) closes \[[#938](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/938)]\[10], \[[#773](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/773)]\[11] - Retire use of node-fetch (\[[`5574831`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/5574831)]\[12]) closes \[[#946](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/946)]\[13] - **src:** warn when invoking testApiHandler with invalid property combos (\[[`db599ac`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/db599ac)]\[14]) ##### šŖ Fixes - Loosen type checking for `NextApiHandler`s (\[[`fdfec8c`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/fdfec8c)]\[15]) - **src:** deeply summon res.json() return value into our realm (\[[`59f54a5`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/59f54a5)]\[16]) - **src:** ensure all results of calling ::json on Requests and Responses are summoned into our realm (\[[`5c5f9a4`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/5c5f9a4)]\[17]) - **src:** ensure AsyncLocalStorage is available globally (might fix \[[#875](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/875)]\[18]) (\[[`43680d9`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/43680d9)]\[19]) - **src:** ensure global fetch is restored after testApiHandler terminates (\[[`75d4e1f`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/75d4e1f)]\[20]) - **src:** forcefully coerce request.body into a ReadableStream (\[[`f715331`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/f715331)]\[21]) - **src:** hoist globalThis.AsyncLocalStorage initialization to be as soon as possible (\[[`85bb8fa`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/85bb8fa)]\[22]) - **src:** normalize pagesHandler into NextApiHandler (esm<->cjs interop) (\[[`0133e11`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/0133e11)]\[23]) - Use more accurate return type for app router patchers (\[[`62f1d0b`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/62f1d0b)]\[24]) ##### āļø Build System - **husky:** ensure hooks do not run on rebase (\[[`913cbd0`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/913cbd0)]\[25]) - **package:** bump minimum supported node versions to maintained (\[[`702cb44`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/702cb44)]\[26]) - **package:** remove outdated properties (\[[`dc23723`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/dc23723)]\[27]) ##### š§šæ Refactored - **src:** ensure request url is consistent across router types (\[[`d72ae87`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/d72ae87)]\[28]) ### [`v3.2.0`](https://togithub.com/Xunnamius/next-test-api-route-handler/blob/HEAD/CHANGELOG.md#320-3-2024-01-04) [Compare Source](https://togithub.com/Xunnamius/next-test-api-route-handler/compare/v3.1.10...v3.2.0) ##### āØ Features - Update headers for msw@2 compatibility (\[[`93b8a3c`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/93b8a3c)]\[4]) closes \[[#916](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/916)]\[5] ##### \[3.1.10]\[6] (2023-11-04) ##### šŖ Fixes - Ensure compat with next@12.1.0 (\[[`ca1da40`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/ca1da40)]\[7]) closes \[[#887](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/887)]\[8] ##### āļø Build System - Add core-js polyfills and have mercy on aging node versions (\[[`a9d136b`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/a9d136b)]\[9]) - Modernize tooling (\[[`db0223e`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/db0223e)]\[10]) - Upgrade typescript-babel toolchain to nodenext (\[[`e457064`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/e457064)]\[11]) closes \[[#908](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/908)]\[12] ##### š„ Reverted - *"docs(readme): update badge links"* (\[[`be90d57`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/be90d57)]\[13]) ##### \[3.1.8]\[14] (2023-01-03) ##### āļø Build System - **readme:** update maintainence badge and audit dependencies (\[[`2a4ae05`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/2a4ae05)]\[15]) ##### \[3.1.7]\[16] (2022-07-27) ##### āļø Build System - **package:** update dependencies (\[[`4af52f4`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/4af52f4)]\[17]) ##### \[3.1.6]\[18] (2022-06-30) ##### šŖ Fixes - Ensure non-object "headers" fetch argument is not mangled when mixing in default headers (\[[`6e94142`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/6e94142)]\[19]) ##### \[3.1.5]\[20] (2022-06-26) ##### šŖ Fixes - Fix MSW bypass override instructions and unit test (\[[`405f84d`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/405f84d)]\[21]) ##### \[3.1.4]\[22] (2022-06-26) ##### āļø Build System - **readme:** update MSW bypass override instructions under "test" entry in README (\[[`b05e112`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/b05e112)]\[23]) ##### \[3.1.3]\[24] (2022-05-21) ##### āļø Build System - **package:** update dev-dependencies (\[[`36a2c44`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/36a2c44)]\[25]) ##### \[3.1.2]\[26] (2022-03-23) ##### āļø Build System - **package:** update dependencies (\[[`065b445`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/065b445)]\[27]) ##### \[3.1.1]\[28] (2022-02-18) ##### šŖ Fixes - Ensure compat with next@12.1.0 (\[[`484d702`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/484d702)]\[29]) closes \[[#487](https://togithub.com/Xunnamius/next-test-api-route-handler/issues/487)]\[30] ##### š„ Reverted - *"refactor: update npm scripts, linting"* (\[[`77ad96d`](https://togithub.com/Xunnamius/next-test-api-route-handler/commit/77ad96d)]\[31])Configuration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.