Performance: Testing module setup
MEDIUM IMPACT
This affects the initial load time and memory usage of test suites by controlling how modules and dependencies are instantiated.
beforeEach(async () => { await Test.createTestingModule({ providers: [MyService, { provide: DepService, useValue: mockDep }], }).compile(); });
beforeEach(async () => { await Test.createTestingModule({ imports: [AppModule], }).compile(); });
| Pattern | Modules Loaded | Memory Usage | Startup Time | Verdict |
|---|---|---|---|---|
| Import full AppModule | All modules | High | Slow | [X] Bad |
| Import only needed providers | Minimal modules | Low | Fast | [OK] Good |