Skip to content

Missing guidance for middleware registration in E2E tests #3295

Description

@mag123c

Current Problem:

The E2E testing documentation at https://docs.nestjs.com/fundamentals/testing#end-to-end-testing doesn't explain the proper order for middleware registration when using different HTTP adapters.

Missing Information:

  • With Express adapter: app.use() can be called before app.init() without errors
  • With Fastify adapter: app.init() must be called before app.use() to avoid "this.instance.use is not a function" error

This inconsistency can confuse developers when switching between adapters or writing E2E tests for Fastify-based applications.

Suggested Addition:
Add a section explaining adapter-specific middleware registration patterns in E2E tests, including code examples for both Express and Fastify adapters.

Related:
issue / pr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions