Jest Folder Structure

The conventions for Jest, in order of best to worst in my opinion:

  1. src/file.test.js mentioned first in the Getting Started docs, and is great for keeping tests (especially unit) easy to find next to source files
  2. src/__tests__/file.test.js lets you have multiple __tests__ directories so tests are still near original files without cluttering the same directories
  3. __tests__/file.test.js more like older test frameworks that put all the tests in a separate directory; while Jest does support it, it’s not as easy to keep tests organized and discoverable

Since you don’t want 1, it sounds like 2 is your best option.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)