All notable changes to this project will be documented in this auto-generated file. The format is based on Conventional Commits; this project adheres to Semantic Versioning.
next-test-api-route-handler@4.0.0 (2024-01-15)
-
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 oftestApiHandler
(i.e.testApiHandler({ handler })
) has been renamed topagesHandler
. It is otherwise functionally equivalent.Those migrating from NTARH@<4, the process should be as simple as renaming
handler
topagesHandler
in your tests and getting on with your life. -
NtarhParameters
has been superseded byNtarhInit
,NtarhInitAppRouter
, andNtarhInitPagesRouter
. -
requestPatcher
,reponsePatcher
, andparamsPatcher
options oftestApiHandler({ ... })
can now be asynchronous and return Promises.paramsPatcher
can additionally return a brand newparams
object that will overwrite the old one rather than merely augmenting it. -
requestPatcher
,reponsePatcher
, andparamsPatcher
options oftestApiHandler({ ... })
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 theappHandler
option. When this option is provided, the function signatures of the following options shift to support standardRequest
/Response
parameters and return types where appropriate:requestPatcher
,responsePatcher
, andparamsPatcher
. 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 oftestApiHandler
(i.e.testApiHandler({ pagesHandler })
) will **not** accept edge runtime routes. To test your edge runtime routes, use theappHandler
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
[email protected]
. Therefore, versions of Next.js older than 14.0.4 **explicitly unsupported** when using theappHandler
option. On the other hand,pagesHandler
will always work regardless of Next.js version until Vercel eventually removes the Pages Router functionality entirely.
- Land initial App Router support (e2d8865) see #938, #773
- Retire use of node-fetch (5574831) see #946
- src: warn when invoking testApiHandler with invalid property combos (db599ac)
- Loosen type checking for
NextApiHandler
s (fdfec8c) - src: deeply summon res.json() return value into our realm (59f54a5)
- src: ensure all results of calling ::json on Requests and Responses are summoned into our realm (5c5f9a4)
- src: ensure AsyncLocalStorage is available globally (might fix #875) (43680d9)
- src: ensure global fetch is restored after testApiHandler terminates (75d4e1f)
- src: forcefully coerce request.body into a ReadableStream (f715331)
- src: hoist globalThis.AsyncLocalStorage initialization to be as soon as possible (85bb8fa)
- src: normalize pagesHandler into NextApiHandler (esm<->cjs interop) (0133e11)
- Use more accurate return type for app router patchers (62f1d0b)
- husky: ensure hooks do not run on rebase (913cbd0)
- package: bump minimum supported node versions to maintained (702cb44)
- package: remove outdated properties (dc23723)
- src: ensure request url is consistent across router types (d72ae87)
🏗️ Patch next-test-api-route-handler@4.0.15 (2025-02-27)
- src: address incompatibility with [email protected] (69525da) see #1129
- deps: bump @whatwg-node/server from 0.9.66 to 0.9.70 (1c11e5d)
🏗️ Patch next-test-api-route-handler@4.0.14 (2024-10-22)
🏗️ Patch next-test-api-route-handler@4.0.13 (2024-10-22)
- src: add support for [email protected] release (edfe781)
🏗️ Patch next-test-api-route-handler@4.0.12 (2024-10-17)
- Prepare compatibility layer for next@15 (a73f21e)
🏗️ Patch next-test-api-route-handler@4.0.11 (2024-09-18)
🏗️ Patch next-test-api-route-handler@4.0.10 (2024-09-18)
- src: pass empty
apiContext
to work aroundmultiZoneDraftMode
check (c061b91)
🏗️ Patch next-test-api-route-handler@4.0.9 (2024-09-13)
- externals: update is-next-compat to work with Octokit's new esm exports (50d2976)
- husky: update husky scripts (88948b6)
- package: downgrade @octokit/rest to 20 (fa4b2af)
- Remove spellchecker dependency (b0701a2)
🏗️ Patch next-test-api-route-handler@4.0.8 (2024-06-10)
🏗️ Patch next-test-api-route-handler@4.0.7 (2024-04-17)
🏗️ Patch next-test-api-route-handler@4.0.6 (2024-04-12)
- src: extend backwards compatibility to msw@1; remove optional msw peer dependency (347d7ef)
🏗️ Patch next-test-api-route-handler@4.0.5 (2024-03-03)
🏗️ Patch next-test-api-route-handler@4.0.4 (2024-03-02)
- src: allow relative url strings passed via url shorthand for App Router (01b86b6) see #1000
- src: prevent recursive redirection with undici/whatwg fetch (22bb716) see #993
- src: replace
AppRouteUserlandModule
with looser type (502e666) see #1006, #1005
🏗️ Patch next-test-api-route-handler@4.0.3 (2024-01-18)
- src: ensure ephemeral test servers only listen on localhost (d7774b3)
- src: forcefully close all connections after closing test server (fixes #962) (d03ca21)
🏗️ Patch next-test-api-route-handler@4.0.2 (2024-01-16)
- src: add missing metadata not revealed by type information (90ff665)
- src: force normalization of request URLs passed to app handler (8400a19)
🏗️ Patch next-test-api-route-handler@4.0.1 (2024-01-16)
- src: pass Next.js more accurate app route metadata (09389fe)
next-test-api-route-handler@3.2.0 (2024-01-04)
next-test-api-route-handler@3.1.0 (2022-02-11)
- Automatically add the x-msw-bypass (21b4b92)
- deps: bump next from 12.0.8 to 12.0.10 (2a2f0b2)
- readme: explain MSW compat default behavior (0ee4ce5)
🏗️ Patch next-test-api-route-handler@3.1.10 (2023-11-04)
- Ensure compat with [email protected] (ca1da40) see #887
- Add core-js polyfills and have mercy on aging node versions (a9d136b)
- Modernize tooling (db0223e)
- Upgrade typescript-babel toolchain to nodenext (e457064) see #908
🏗️ Patch next-test-api-route-handler@3.1.8 (2023-01-03)
- readme: update maintainence badge and audit dependencies (2a4ae05)
🏗️ Patch next-test-api-route-handler@3.1.7 (2022-07-27)
- package: update dependencies (4af52f4)
🏗️ Patch next-test-api-route-handler@3.1.6 (2022-06-30)
- Ensure non-object "headers" fetch argument is not mangled when mixing in default headers (6e94142)
🏗️ Patch next-test-api-route-handler@3.1.5 (2022-06-26)
- Fix MSW bypass override instructions and unit test (405f84d)
🏗️ Patch next-test-api-route-handler@3.1.4 (2022-06-26)
- readme: update MSW bypass override instructions under "test" entry in README (b05e112)
🏗️ Patch next-test-api-route-handler@3.1.3 (2022-05-21)
- package: update dev-dependencies (36a2c44)
🏗️ Patch next-test-api-route-handler@3.1.2 (2022-03-23)
- package: update dependencies (065b445)
🏗️ Patch next-test-api-route-handler@3.1.1 (2022-02-18)
- Ensure compat with [email protected] (484d702) see #487
next-test-api-route-handler@3.0.0 (2021-12-17)
-
fetch
now comes from node-fetch directly instead of isomorphic-unfetch -
Exported
TestParameters
type has been renamed toNtarhParameters
- package: remove debug dependency (moved into dev-deps) (d3c60cb)
- src: improved error handling; add support for new
rejectOnHandlerError
option (68d30da) - src: move test-listen functionality into NTARH; remove dependency (15c899a)
- src: replace isomorphic-unfetch with node-fetch (5a1a2ee)
- src: update types (73f44b7)
🏗️ Patch next-test-api-route-handler@3.0.3 (2022-02-05)
- package: bump node-fetch to 2.6.7 (1e8cd85)
🏗️ Patch next-test-api-route-handler@3.0.2 (2022-01-03)
- readme: update shields.io maintenance badge to 2022 (84f74f5)
🏗️ Patch next-test-api-route-handler@3.0.1 (2021-12-27)
- package: retire use of sort-package-json fork (a925da2)
next-test-api-route-handler@2.3.0 (2021-11-05)
- src: ensure exceptions do not prevent Jest from exiting (8746e5f)
- src: ensure webpack does not break dynamic require on compile (ae778d1) see #378
- Vastly improved error handling for those using node@<15 and/or npm@<7 (c216caa)
- Add back nullish coalescing operator babel transform for older node versions (5fbb6d2)
- package: backport npm script fixes (346e8de)
- src: fix TS bundle errors on node@12 and node@14 (812e6f2)
🏗️ Patch next-test-api-route-handler@2.3.4 (2021-11-16)
- src: lazy-load contents of the "cookies" field (854704b)
- Re-enable treeshaking in webpack (9302bcc)
🏗️ Patch next-test-api-route-handler@2.3.3 (2021-11-10)
- Differentiate between esm and bundler distributables (597c249)
🏗️ Patch next-test-api-route-handler@2.3.2 (2021-11-07)
- src: es module compatibility; no longer attempts to require() in mjs files (32eafab)
- src: report parsed es module import failures properly (cd98aab)
🏗️ Patch next-test-api-route-handler@2.3.1 (2021-11-06)
- Re-enable ESM (for bundlers) integration tests (91f08d4)
next-test-api-route-handler@2.2.0 (2021-08-22)
- types: expanded typescript support;
testApiHandler
weakly typed by default (419d5fe)
🏗️ Patch next-test-api-route-handler@2.2.1 (2021-08-29)
- license: switch to MIT license (de9ee17)
next-test-api-route-handler@2.1.0 (2021-08-13)
- webpack.config: do not ignore warnings (2b14d84)
- webpack.config: fix faulty env management (f477260)
🏗️ Patch next-test-api-route-handler@2.1.3 (2021-08-22)
- src: ensure dependency resolution failure does not cause test runner to hang (7916f00)
🏗️ Patch next-test-api-route-handler@2.1.2 (2021-08-14)
- src: memoize resolver import (74241ee)
- package: improve build-docs npm script (33b6a34)
- src: add descriptions to TypeScript types (1c3425c)
🏗️ Patch next-test-api-route-handler@2.1.1 (2021-08-13)
- readme: update install instructions; fix apollo example (fd787ca)
- webpack.config: second fix for faulty env management (87ed12b)
next-test-api-route-handler@2.0.0 (2021-06-27)
- This version (and the version before this version) no longer works with next@<10
- Add
url
andparamsPatcher
(ee31fa8)
- package.json: update dependencies (2f1125c)
- package.json: update dependencies (7583209)
- package.json: update next peer dependency to >=10.0.x (bc5e72d)
- Switch to @xunnamius/conventional-changelog-projector shared config (bc7eb3d)
- Update dependencies (20ca255)
🏗️ Patch next-test-api-route-handler@2.0.2 (2021-07-29)
- external-scripts: use latest mongodb native driver (fd53fef)
- webpack.config.js: more robust build process (e5c6a99)
🏗️ Patch next-test-api-route-handler@2.0.1 (2021-06-27)
- Update dependencies and publish fixed apollo example (ef32668)
next-test-api-route-handler@1.2.0 (2021-01-05)
- .changelogrc.js: transfer repository over to semantic-release CI/CD (b9d2bf0)
- deps: bump node-notifier from 8.0.0 to 8.0.1 (45a79d4)
- test/unit-externals.test.ts: add mongo uri env var to test explicitly (e0e1fd9)
🏗️ Patch next-test-api-route-handler@1.2.24 (2021-05-08)
- index.ts: next 10.2.0 compat (af177c5)
- .github/workflows: disable old pipeline; begin transition to new pipeline (364549e)
- .github/workflows: overhaul pipeline workflows (4db5d04)
- .github: split BTD workflow into two separate workflows (security) (99ad127)
- contributing.md: split pipeline architecture information off into workflow README.md (6d52302)
- package.json: ensure hidden dirs' markdown files are seen by remark (linted and formatted) (1f7fad4)
- package.json: update dependencies (d328a86)
- readme.md: fix broken links (6e7173f)
- readme.md: improvements (23cb780)
- readme.md: include architecture description as workflow README.md (1f25e5f)
🏗️ Patch next-test-api-route-handler@1.2.23 (2021-03-14)
- Better documentation (0040582)
🏗️ Patch next-test-api-route-handler@1.2.22 (2021-03-12)
- Update dependencies and fix find-package-json usage (df9ede3)
🏗️ Patch next-test-api-route-handler@1.2.21 (2021-03-12)
- build-test-deploy.yml: actions version updates (29aa25a)
- build-test-deploy.yml: rollback some pipeline version updates (8065757)
- package.json: fix typedoc-markdown-plugin patch (dd3e7fa) see #126
🏗️ Patch next-test-api-route-handler@1.2.20 (2021-02-22)
- package-lock.json: update deps (5a2d98f)
🏗️ Patch next-test-api-route-handler@1.2.19 (2021-02-22)
- .changelogrc.js: fix dark magic (b4157eb)
- is-next-compat.ts: never use console.log (81533c8)
- is-next-compat.ts: use template string instead of literal (3a4f0f1)
- unit-index.test.ts: 100% test coverage (72189e8)
- .eslintrc.js: account for node 12 (cad0fb2)
- .github: update workflows and templates (54e51eb)
- Backport new webpack config (b268534)
- integration-external.test.ts: ensure proper cwd is used for executing externals (31c1d5b)
- is-next-compat.ts: use execa instead of shelljs under the hood (9d12004)
- package.json: remove shelljs, update other deps (11e192a)
- package.json: update dependencies (9e1705b)
- Rename env-expect to expect-env (035e98b)
- setup.ts: fix several lib-pkg tools (44d1967)
- Spellcheck-commit and .changelogrc no longer use shelljs (dd72fd1)
- test: update with new lib-pkg tools (004a657)
- unit-external.test.ts: update with new lib-pkg tools (6df7e73)
🏗️ Patch next-test-api-route-handler@1.2.18 (2021-02-11)
- package.json: update to proper forked dependencies (042291d)
🏗️ Patch next-test-api-route-handler@1.2.17 (2021-02-10)
- webpack.config.js: normalize webpack configuration across repos (65f48a3)
- webpack.config.js: remove ES6 syntax from JS file (5ed6dbd)
🏗️ Patch next-test-api-route-handler@1.2.16 (2021-02-10)
- package.json: update dependencies (aeef7a9)
🏗️ Patch next-test-api-route-handler@1.2.15 (2021-02-08)
- readme.md: simplify all examples with more modern syntax; remove @ergodark/types (964bc47)
🏗️ Patch next-test-api-route-handler@1.2.14 (2021-02-08)
- readme.md: add Apollo example and additional guidance (ed357f5)
🏗️ Patch next-test-api-route-handler@1.2.13 (2021-02-05)
- config: use transform-rename-import when building externals (d224f5e)
- index.ts: use NextApiHandler type (thanks @janhesters) (473ff50)
- integration-webpack.test.ts: actually call bundle in test (f7a12de)
- is-next-compat.ts: better handling of generics (d7bc091)
- Next no longer misclassified as CJS (9ebac01)
- build-test-deploy.yml: drop support for node 10 (6adde15)
- build-test-deploy.yml: drop support for webpack 4 (e508c06)
- build-test-deploy.yml: remove externals exception (5e3893a)
- cleanup.yml: fix bugs in workflow (cbf22fd)
- Drop support for node 10 (71e9103)
- Only silence sjx if not DEBUG (f01ce40)
- package.json: improved build-dist (a3526f2)
- package.json: nicer destructured vals in docs (661e62d)
- package.json: remove extraneous module (1f2ad6a)
- package.json: update dependencies (c64f761)
- post-release-check.yml: add five-minute-sleep (4a0552d)
- post-release-check.yml: more resilient post-release check (856435f)
- Properly mocked unit tests for externals (b3273df)
- test: improved testing infrastructure (fffe02e)
- types: more precise unique-filename type (a60793c)
🏗️ Patch next-test-api-route-handler@1.2.12 (2021-01-23)
- Remove erroneous module import (6eb2a34)
🏗️ Patch next-test-api-route-handler@1.2.11 (2021-01-23)
- Backport/normalize across packages (e589c1d)
🏗️ Patch next-test-api-route-handler@1.2.10 (2021-01-22)
- Update debug statement syntax (52a2276)
🏗️ Patch next-test-api-route-handler@1.2.9 (2021-01-21)
- .github/workflows/build-test-deploy.yml: fix peer dependency installation (12e5bbe)
🏗️ Patch next-test-api-route-handler@1.2.8 (2021-01-13)
- readme.md: ensure quick start example is functional (87dc31f)
🏗️ Patch next-test-api-route-handler@1.2.7 (2021-01-12)
🏗️ Patch next-test-api-route-handler@1.2.6 (2021-01-06)
- package.json: prune old deps (2cf1d29)
🏗️ Patch next-test-api-route-handler@1.2.5 (2021-01-06)
- .github/workflows/post-release-check.yml: add new post-release-check (a307efc)
- .github: add is-next-compat workflow (1823c05)
🏗️ Patch next-test-api-route-handler@1.2.4 (2021-01-06)
- readme.md: add quick start example (4e5e12c)
🏗️ Patch next-test-api-route-handler@1.2.3 (2021-01-05)
- package.json: favor "prepare" over "postinstall" and use npx for dev tools (a111c87)
🏗️ Patch next-test-api-route-handler@1.2.2 (2021-01-05)
- readme.md: cosmetic (98b65c6)
🏗️ Patch next-test-api-route-handler@1.2.1 (2021-01-05)
- package.json: update dependencies, prune unused dependencies (6ef6cbe)
next-test-api-route-handler@1.1.0 (2020-11-25)
- build: move Next.js dependency to peer/dev dependencies (0e7541f)
- externals: updated remaining dependency references to peerDependency references (ccf54fb)
🏗️ Patch next-test-api-route-handler@1.1.3 (2020-12-06)
🏗️ Patch next-test-api-route-handler@1.1.2 (2020-11-26)
- readme: update install language (b68c721)
🏗️ Patch next-test-api-route-handler@1.1.1 (2020-11-26)
- externals: revert sort-package-json to maintainer version (750055b)
- externals: rewrite test workflow (d604dfc)