We are using the injector from AppModule.injector
in some of our Decorators. Everything works fine except for when we run tests that include such a Decorator at some point: Uncaught TypeError: enum_decorator_1.Enum is not a function
while Enum() is the Decorator name.
export class AppModule {
static injector: Injector;
static changeDetectorRef: ChangeDetectorRef;
constructor(public injector: Injector) {
AppModule.injector = injector;
}
}
I assume the bootstrapping in tests works differently and the injector isn't available for some reason. When I comment out the parts regarding the AppModule.injector in the Decorator, everything works.
The test code itself doens't matter. What happens is this:
- I initialize a Service
fileService = new FileService(communicationServiceMock);
- That service imports an exported const variable
- That const variable imports a class that is decorated with Enum() decorator
Has anyone faced similar problems?
Aucun commentaire:
Enregistrer un commentaire