Skip to content

Jest

Location of Jest tests

Tests should live local to the the file under test, in a directory called __test__. i.e. tests for src/components/file.js should live at src/components/__test__/file.test.js

Bad

tests/
  |- components/
    |- button.test.js
    |- select.test.js
components/
  |- button.js
  |- select.js
components/
  |- button.test.js
  |- select.test.js
  |- button.js
  |- select.js

Good

components/
  |- __test__/
    |- button.test.js
    |- select.test.js
  |- button.js
  |- select.js