MCPcopy Index your code
hub / github.com/angular/angular / withModule

Function withModule

packages/core/testing/src/test_bed.ts:983–998  ·  view source on GitHub ↗
(
  moduleDef: TestModuleMetadata,
  fn?: Function | null,
)

Source from the content-addressed store, hash-verified

981export function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
982export function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;
983export function withModule(
984 moduleDef: TestModuleMetadata,
985 fn?: Function | null,
986): (() => any) | InjectSetupWrapper {
987 if (fn) {
988 // Not using an arrow function to preserve context passed from call site
989 return function (this: unknown) {
990 const testBed = TestBedImpl.INSTANCE;
991 if (moduleDef) {
992 testBed.configureTestingModule(moduleDef);
993 }
994 return fn.apply(this);
995 };
996 }
997 return new InjectSetupWrapper(() => moduleDef);
998}

Calls 2

applyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…