Babel Plugin Relative Import
Import files for tests as easy if they are in the same folder as the tested. give your folder structure
src/
component/
fileTotest.js
__tests__/
component/
fileTotest.test.js
in your fileTotest.test.js
;// Gets compiled to:;// No more unecessarie paths!
Quickstart
npm install babel-plugin-relative-import --save-dev
Add a .babelrc
file and write:
"plugins": "babel-plugin-reflexive-import"
Options
You can use a custom root with the testPathFolder
option.
And you can set the off set between your source and test.
"plugins": "babel-plugin-relative-import" "testFolder": "__tests__" "srcFolder": "src"
Inspiration
Inspired by the babel-relative-import from Olivier Louvignes.