Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using Test.createTestingModule(), Change to Injector.ts is Swallowing Exceptions with a Maximum Call Stack Error #14347

Open
2 tasks done
camoore1979 opened this issue Dec 20, 2024 · 1 comment
Labels
needs triage This issue has not been looked into type: bug 😭

Comments

@camoore1979
Copy link

Did you read the migration guide?

  • I have read the whole migration guide

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Potential Commit/PR that introduced the regression

PR #14133 / Commit 229d97f

NestJS version

10.1.2 -> 10.4.15

Describe the regression

We have a fairly large and complex Nest.js application and in a recent upgrade from 10.1.2 to 10.4.15, our application would run successfully but integration test suites began failing with a RangeError: Maximum call stack size exceeded exception when attempting to setup our App module for testing with Test.createTestingModule. We were getting the error in almost any case even when only creating a testing module with as few modules as possible. Eventually we realized that exceptions thrown in our code were being caught and swallowed. For instance we could leave out a required environment variable from our Config service and it was throwing the expected error for the undefined configuration value but this was masked by the RangeError. Eventually, we determined that this was caused by recent changes to packages/core/injector/injector.ts, we were able to comment out the changes locally and our test would throw the expected exception.

Thus, in fairly complex Nest.js Apps this recent change may be swallowing exceptions and throwing a misleading exception.

Minimum reproduction code

No response

Input code

Expected behavior

Exceptions in application code should not be swallowed by catches within the Nest.js framework.

Other

Node.js 22.11.0, Typescript 5.7.2

image

@camoore1979 camoore1979 added needs triage This issue has not been looked into type: bug 😭 labels Dec 20, 2024
@kamilmysliwiec
Copy link
Member

Could you please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project)? This would allow us to fix this issue much faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into type: bug 😭
Projects
None yet
Development

No branches or pull requests

2 participants