title: Component declaration in spec files as opposed to loading the top-level module into TestBed
body: <p>I have an Angular (4.x) application with a top-level module <code>AppModule</code>, which declares several custom components, so they can be used in templates.</p>
  
  <p>However, for jasmine/karma tests the most common approach seems to be using <code>BrowserDynamicTestingModule</code> and declare any required custom components during <code>beforeEach</code>, e.g.:</p>
  
  <pre class="lang-js prettyprint-override"><code>beforeEach(async(() =&gt; {
    TestBed.configureTestingModule({
      declarations: [ MyComponent, SomeDependedUponComponent ]
    })
    .compileComponents();
  }));
  </code></pre>
  
  <p>Considering we're simulating the main application's environment anyway, why wouldn't one just initialize the testBed with <code>AppModule</code>, so every custom component is available to all tests? Something like:</p>
  
  <pre class="lang-js prettyprint-override"><code>getTestBed().initTestEnvironment(
    [BrowserDynamicTestingModule, AppModule],
    platformBrowserDynamicTesting()
  );
  </code></pre>
  
  <p>If I'm not missing something, this is much closer to the main application's setup and even reduces boilerplate code in individual spec/test files. Orre there any disadvantages, such as a performance penalty?</p>