Background:
I am currently using bs-jest for unit testing. In addition, I am using the bsb init project, meaning that I am first compiling files using Reason/Bucklescript + then running compiled files using Webpack.
Jest by default will pick up files that have the word test in them, for instance component.test.js, will be picked up by default by Jest.
Bs-jest will work by default, with files being put in the __tests__
directory. However, my spec files following the *.test.re
pattern, put in my components folder, i.e. put in a folder other than __tests__
will not compile to the appropriate *test.js
file.
Objective:
Compile:
├── Components
| ├── toolbar
| | └── toolbar.re
| | └── toolbar.test.re
To:
├── Components
| ├── toolbar
| | └── toolbar.bs.js
| | └── toolbar.test.bs.js
and then have Jest run and work as it currently does by default.
Any help is more than appreciated. Thank you.
This has to do with the fact that in your bsconfig.json, your package is marked as dev. Which means it will not be able to be picked up in non dev sources, such as your src folder. By moving it to a regular dependency, it will work as expected.
That being said, now you can understand architecture of perhaps why it is in it's own folder, due to compilation reasons.