Skip to content

Global Injections

It’s possible to define injections which will be available for each test without the need to re-declare them in each test:

test.ts
import { defineGlobalsInjections } from '@openng/spectator';
import { TranslocoModule } from '@jsverse/transloco';
defineGlobalsInjections({
imports: [TranslocoModule],
});

Please be aware, that defineGlobalsInjections() must be called before the modules are loaded. In the default Angular test.ts this means before this line:

context.keys().map(context);