title: Pros and cons of placing test files in the same folder as source files, or separate under test/
body: <p>What are the advantages and disadvantages of placing test files next to the source files they test (in the same <code>src</code> directory), vs. in a separate <code>tests</code> directory, mirroring the <code>src</code> hierarchy? </p>
  
  <p>Having them in the same folder seems to make life easier when it comes to maintenance, but also crowds the source directories.</p>
  
  <p><strong>Option 1:</strong> Directory structure when having separate folders for source and tests:</p>
  
  <pre><code>- src
  +-- item.ts
  `-- util
      +-- helper.ts
  
  - test
  +-- item.test.ts
  `-- util
      `-- helper.test.ts
  </code></pre>
  
  <p><strong>Option 2:</strong> Directory structure when having both types of files in the same directory:</p>
  
  <pre><code>- src
  +-- item.ts
  +-- item.test.ts
  `-- util
      +-- helper.ts
      `-- helper.test.ts
  </code></pre>
  
  <p>I used to always go with option 1 until trying out <code>angular-cli</code> and having it generate code files alongside the test files as in option 2, which made me rethink the whole thing.</p>