Skip to content

fix(test): use routerOptions.constraints to avoid FSTDEP022 warning - #483

Open
Tony133 wants to merge 1 commit into
mainfrom
fix/fstdep022-constraints-routerOptions
Open

fix(test): use routerOptions.constraints to avoid FSTDEP022 warning#483
Tony133 wants to merge 1 commit into
mainfrom
fix/fstdep022-constraints-routerOptions

Conversation

@Tony133

@Tony133 Tony133 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Proposal:

Fixes the FSTDEP022 deprecation warning shown when running the test suite on Fastify v5 ( see screenshot )

screenshot

The constraints and constraints with unconstrained routes tests create the Fastify instance with constraints as a top-level option, which is deprecated in v5 and will be removed in v6:

// before
const server = Fastify({
  constraints: { testConstraint: getTestConstraint() }
})

// after
const server = Fastify({
  routerOptions: {
    constraints: { testConstraint: getTestConstraint() }
  }
})

Only test/test.js is affected — index.js uses constraints at the route level (fastify.route()), which is a different, non-deprecated option.

Note:

  • Verified: node --test test/test.js test/websocket.js → all passing, no warnings, coverage unchanged.

Fastify(options) with a top-level 'constraints' key is deprecated in
Fastify v5 and will be removed in v6 (FSTDEP022). Move it under
routerOptions in the 'constraints' and 'constraints with unconstrained
routes' tests. No behavior change; route-level constraints passed to
fastify.route() are unaffected by this deprecation.
@Tony133
Tony133 marked this pull request as ready for review September 7, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant