Skip to content

Latest commit

 

History

History
1133 lines (757 loc) · 57.7 KB

CHANGELOG.md

File metadata and controls

1133 lines (757 loc) · 57.7 KB

Changelog

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)

💥 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 [email protected]. 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) see #938, #773
  • Retire use of node-fetch (5574831) see #946
  • src: warn when invoking testApiHandler with invalid property combos (db599ac)

🪄 Fixes

  • Loosen type checking for NextApiHandlers (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)

⚙️ Build System

  • husky: ensure hooks do not run on rebase (913cbd0)
  • package: bump minimum supported node versions to maintained (702cb44)
  • package: remove outdated properties (dc23723)

🧙🏿 Refactored

  • src: ensure request url is consistent across router types (d72ae87)

🏗️ Patch next-test-api-route-handler@4.0.15 (2025-02-27)

🪄 Fixes

⚙️ Build System

  • 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)

🪄 Fixes

  • package: revert breaking change in engines.node (cde5496) see #1115

🏗️ Patch next-test-api-route-handler@4.0.13 (2024-10-22)

🪄 Fixes


🏗️ Patch next-test-api-route-handler@4.0.12 (2024-10-17)

⚙️ Build System

  • Prepare compatibility layer for next@15 (a73f21e)

🏗️ Patch next-test-api-route-handler@4.0.11 (2024-09-18)

🪄 Fixes

  • src: stop Next.js from attempting to statically generate routes under test (a461e81) see #1076

🏗️ Patch next-test-api-route-handler@4.0.10 (2024-09-18)

🪄 Fixes

  • src: pass empty apiContext to work around multiZoneDraftMode check (c061b91)

🏗️ Patch next-test-api-route-handler@4.0.9 (2024-09-13)

🪄 Fixes

  • src: prevent ipv6-related failures due to assuming "localhost" resolvability (99118a6) see #1068

⚙️ Build System

  • 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)

⚙️ Build System

  • Revert conventional-changelog-cli update (9967120)
  • Update documentation generator (43eec53)

🏗️ Patch next-test-api-route-handler@4.0.7 (2024-04-17)

⚙️ Build System

  • babel: update core-js to 3.37 (b6b5164)
  • readme: add section on jsdom support (a48555f)

🏗️ Patch next-test-api-route-handler@4.0.6 (2024-04-12)

🪄 Fixes

  • 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)

🪄 Fixes


🏗️ Patch next-test-api-route-handler@4.0.4 (2024-03-02)

🪄 Fixes

  • 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)

🪄 Fixes

  • 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)

🪄 Fixes

  • 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)

🪄 Fixes

  • src: pass Next.js more accurate app route metadata (09389fe)

next-test-api-route-handler@3.2.0 (2024-01-04)

✨ Features

  • Update headers for msw@2 compatibility (93b8a3c) see #916

next-test-api-route-handler@3.1.0 (2022-02-11)

✨ Features

  • Automatically add the x-msw-bypass (21b4b92)

⚙️ Build System

  • 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)

🪄 Fixes

⚙️ Build System

  • 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)

⚙️ Build System

  • readme: update maintainence badge and audit dependencies (2a4ae05)

🏗️ Patch next-test-api-route-handler@3.1.7 (2022-07-27)

⚙️ Build System

  • package: update dependencies (4af52f4)

🏗️ Patch next-test-api-route-handler@3.1.6 (2022-06-30)

🪄 Fixes

  • 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)

🪄 Fixes

  • Fix MSW bypass override instructions and unit test (405f84d)

🏗️ Patch next-test-api-route-handler@3.1.4 (2022-06-26)

⚙️ Build System

  • readme: update MSW bypass override instructions under "test" entry in README (b05e112)

🏗️ Patch next-test-api-route-handler@3.1.3 (2022-05-21)

⚙️ Build System

  • package: update dev-dependencies (36a2c44)

🏗️ Patch next-test-api-route-handler@3.1.2 (2022-03-23)

⚙️ Build System

  • package: update dependencies (065b445)

🏗️ Patch next-test-api-route-handler@3.1.1 (2022-02-18)

🪄 Fixes


next-test-api-route-handler@3.0.0 (2021-12-17)

💥 BREAKING CHANGES 💥

  • fetch now comes from node-fetch directly instead of isomorphic-unfetch

  • Exported TestParameters type has been renamed to NtarhParameters

✨ Features

  • 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)

🧙🏿 Refactored


🏗️ Patch next-test-api-route-handler@3.0.3 (2022-02-05)

⚙️ Build System

  • package: bump node-fetch to 2.6.7 (1e8cd85)

🏗️ Patch next-test-api-route-handler@3.0.2 (2022-01-03)

⚙️ Build System

  • readme: update shields.io maintenance badge to 2022 (84f74f5)

🏗️ Patch next-test-api-route-handler@3.0.1 (2021-12-27)

⚙️ Build System

  • package: retire use of sort-package-json fork (a925da2)

next-test-api-route-handler@2.3.0 (2021-11-05)

✨ Features

  • Automatically parse "set-cookie" headers; available in response.cookies (cd3cd95) see #373

🪄 Fixes

  • 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)

⚙️ Build System

  • 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)

🪄 Fixes

  • src: lazy-load contents of the "cookies" field (854704b)

⚙️ Build System

  • Re-enable treeshaking in webpack (9302bcc)

🏗️ Patch next-test-api-route-handler@2.3.3 (2021-11-10)

⚙️ Build System

  • Differentiate between esm and bundler distributables (597c249)

🏗️ Patch next-test-api-route-handler@2.3.2 (2021-11-07)

🪄 Fixes

  • 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)

⚙️ Build System

  • Re-enable ESM (for bundlers) integration tests (91f08d4)

next-test-api-route-handler@2.2.0 (2021-08-22)

✨ Features

  • types: expanded typescript support; testApiHandler weakly typed by default (419d5fe)

🏗️ Patch next-test-api-route-handler@2.2.1 (2021-08-29)

⚙️ Build System

  • license: switch to MIT license (de9ee17)

next-test-api-route-handler@2.1.0 (2021-08-13)

✨ Features

  • src: enable backwards compatibility all the way back to next@9 (c51cf02) see #295

⚙️ Build System

  • 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)

🪄 Fixes

  • 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)

🪄 Fixes

  • src: memoize resolver import (74241ee)

⚙️ Build System

  • 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)

🪄 Fixes

  • readme: update install instructions; fix apollo example (fd787ca)

⚙️ Build System

  • webpack.config: second fix for faulty env management (87ed12b)

next-test-api-route-handler@2.0.0 (2021-06-27)

💥 BREAKING CHANGES 💥

  • This version (and the version before this version) no longer works with next@<10

✨ Features

  • Add url and paramsPatcher (ee31fa8)

⚙️ Build System

  • 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)

⚙️ Build System

  • 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)

⚙️ Build System

  • Update dependencies and publish fixed apollo example (ef32668)

next-test-api-route-handler@1.2.0 (2021-01-05)

✨ Features

  • .changelogrc.js: transfer repository over to semantic-release CI/CD (b9d2bf0)

⚙️ Build System

  • 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)

🪄 Fixes

  • index.ts: next 10.2.0 compat (af177c5)

⚙️ Build System

  • .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)

⚙️ Build System


🏗️ Patch next-test-api-route-handler@1.2.22 (2021-03-12)

⚙️ Build System

  • Update dependencies and fix find-package-json usage (df9ede3)

🏗️ Patch next-test-api-route-handler@1.2.21 (2021-03-12)

⚙️ Build System

  • 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)

⚙️ Build System

  • package-lock.json: update deps (5a2d98f)

🏗️ Patch next-test-api-route-handler@1.2.19 (2021-02-22)

🪄 Fixes

  • .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)

⚙️ Build System

  • .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)

⚙️ Build System

  • package.json: update to proper forked dependencies (042291d)

🏗️ Patch next-test-api-route-handler@1.2.17 (2021-02-10)

⚙️ Build System

  • 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)

⚙️ Build System

  • package.json: update dependencies (aeef7a9)

🏗️ Patch next-test-api-route-handler@1.2.15 (2021-02-08)

🪄 Fixes

  • 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)

🪄 Fixes

  • readme.md: add Apollo example and additional guidance (ed357f5)

🏗️ Patch next-test-api-route-handler@1.2.13 (2021-02-05)

🪄 Fixes

  • 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 System

  • 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)

⚙️ Build System

  • Remove erroneous module import (6eb2a34)

🏗️ Patch next-test-api-route-handler@1.2.11 (2021-01-23)

⚙️ Build System

  • Backport/normalize across packages (e589c1d)

🏗️ Patch next-test-api-route-handler@1.2.10 (2021-01-22)

⚙️ Build System

  • Update debug statement syntax (52a2276)

🏗️ Patch next-test-api-route-handler@1.2.9 (2021-01-21)

⚙️ Build System

  • .github/workflows/build-test-deploy.yml: fix peer dependency installation (12e5bbe)

🏗️ Patch next-test-api-route-handler@1.2.8 (2021-01-13)

🪄 Fixes

  • readme.md: ensure quick start example is functional (87dc31f)

🏗️ Patch next-test-api-route-handler@1.2.7 (2021-01-12)

⚙️ Build System

  • Rebuild lockfile (94cfa38)
  • Update babel-plugin-transform-mjs-imports (62089c7)

🏗️ Patch next-test-api-route-handler@1.2.6 (2021-01-06)

⚙️ Build System

  • package.json: prune old deps (2cf1d29)

🏗️ Patch next-test-api-route-handler@1.2.5 (2021-01-06)

⚙️ Build System

  • .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)

⚙️ Build System

  • readme.md: add quick start example (4e5e12c)

🏗️ Patch next-test-api-route-handler@1.2.3 (2021-01-05)

⚙️ Build System

  • 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)

⚙️ Build System


🏗️ Patch next-test-api-route-handler@1.2.1 (2021-01-05)

⚙️ Build System

  • package.json: update dependencies, prune unused dependencies (6ef6cbe)

next-test-api-route-handler@1.1.0 (2020-11-25)

🪄 Fixes

  • 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)

⚙️ Build System

  • package.json: audit and update deps (c82695a)
  • package.json: manually bump version (813b21a)

🏗️ Patch next-test-api-route-handler@1.1.2 (2020-11-26)

🪄 Fixes

  • readme: update install language (b68c721)

🏗️ Patch next-test-api-route-handler@1.1.1 (2020-11-26)

🪄 Fixes

  • externals: revert sort-package-json to maintainer version (750055b)
  • externals: rewrite test workflow (d604dfc)

[email protected] (2020-10-07)


🏗️ Patch next-test-api-route-handler@1.0.10 (2020-10-24)


🏗️ Patch next-test-api-route-handler@1.0.9 (2020-10-23)


🏗️ Patch next-test-api-route-handler@1.0.8 (2020-10-20)


🏗️ Patch next-test-api-route-handler@1.0.7 (2020-10-19)


🏗️ Patch next-test-api-route-handler@1.0.6 (2020-10-17)


🏗️ Patch next-test-api-route-handler@1.0.5 (2020-10-13)


🏗️ Patch next-test-api-route-handler@1.0.4 (2020-10-12)


🏗️ Patch next-test-api-route-handler@1.0.3 (2020-10-12)


🏗️ Patch next-test-api-route-handler@1.0.2 (2020-10-07)


🏗️ Patch next-test-api-route-handler@1.0.1 (2020-10-07)