-
Notifications
You must be signed in to change notification settings - Fork 98
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
How to inject into another module? #94
Comments
@schw4rzlicht I'm having a similar issue and I was wondering if you (or anyone else) has found a solution? I'm having trouble primarily with testing modules that contain the sentry client |
It seems like @xiifain might know what's going on? |
do you have a minimal reproducible repo for it @schw4rzlicht. Regarding the testing context, you can import the describe('Service', () => {
let service: TestService;
const config: SentryModuleOptions = {
dsn: '',
debug: true,
environment: 'development',
logLevels: ['debug'],
};
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [SentryModule.forRoot({ ...config })],
providers: [
<your providers>
]
}).compile();
service = module.get<TestService>(TestService);
});
} |
@xiifain Thanks for the clarification! I didn't realize I needed to import the sentry module with configuration but it makes sense. I pulled the actual call into it's own file so I could import it in multiple places. Thanks! |
Hey there!
I am currently importing the module in my
AppModule
and configure it there. When I try to DI theSentryService
into another module's service using@InjectSentry()
, I only get this errordespite
SomeModule
imports theSentryModule
from this package.Is it even possible to import the Sentry module without reconfiguring Sentry for the current module which would make it a little bit verbose imho?
Thanks for your help!
The text was updated successfully, but these errors were encountered: