-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
HTTP_SERVER_REF is undefined in TestingModule context #1282
Comments
Injecting the HttpAdapter using moduleRef on application bootstrap does not work either: ...
public onApplicationBootstrap() {
// Get the http adapter of nestjs
this.httpAdapter = this.moduleRef.get<HttpServer>(HTTP_SERVER_REF); // Returns: {}
this.httpServer = this.httpAdapter.getHttpServer();
} I think the problem lies in the e2e-spec file; const moduleFixture = await Test.createTestingModule({
// AppModule uses the `TerminusBootstrapService`
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init(); The AppModule gets compiled first. During this compilation it sets the |
Actually, |
Oh great, fixed it with nestjs/terminus#18 using the mentioned nestjs/terminus is now ready from my side :) |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
I have a service, which injects the
HTTP_SERVER_REF
token from@nestjs/core
and requests the HTTP server on application bootstrapIf I inject this service in a Testing Module Context (e2e) like so:
I get the following error message:
Expected behavior
HTTP_SERVER_REF
should provide a HTTP adapter in the Testing Module ContextWhat is the motivation / use case for changing the behavior?
Because of this error the e2e tests are failing of your app, if you use
@nestjs/terminus
TerminusModule in your application context.Environment
The text was updated successfully, but these errors were encountered: