Skip to content

fix: add after each app.close() to e2e template#2313

Merged
kamilmysliwiec merged 2 commits into
nestjs:masterfrom
lrousseau-wanadev:fix/e2e-template-app-close
Mar 30, 2026
Merged

fix: add after each app.close() to e2e template#2313
kamilmysliwiec merged 2 commits into
nestjs:masterfrom
lrousseau-wanadev:fix/e2e-template-app-close

Conversation

@lrousseau-wanadev

@lrousseau-wanadev lrousseau-wanadev commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

The E2E template generated by the NestJS CLI initializes the application in a beforeEach hook but never closes it. The missing app.close() call in an afterEach / afterAll hook prevents Jest from exiting cleanly, causing the test suite to hang indefinitely on CI.

Issue Number: nestjs/nest-cli#3293

What is the new behavior?

An afterEach hook calling await app.close() to the generated E2E test template.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

await app.init();
});

afterEach(async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you move it to the end of the describe block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kamilmysliwiec kamilmysliwiec merged commit 9bd26e7 into nestjs:master Mar 30, 2026
1 check passed
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.

2 participants