ForestAdmin / forest-express-mongoose

🌱 ExpressJS/Mongoose agent for Forest Admin to integrate directly to your existing ExpressJS/Mongoose backend application.
https://www.forestadmin.com
GNU General Public License v3.0
193 stars 28 forks source link

Question : How to ignore test files and folders inside `/models` folder #141

Closed Aarbel closed 4 years ago

Aarbel commented 5 years ago

In my /models folder i have MODEL.test.js files and also an ./old/ folder for old models.

On Express App start, i've got this ForestAdmin error : ReferenceError: describe is not defined, which is obviously a MochaJS error. All works fine when i remove all the test files from the /models folder.

How could i make ForestAdmin ignore these test files and this folder ?

Thanks a lot for your help !

rap2hpoutre commented 4 years ago

Sorry for this super-late answer. This issue has been fixed via this PR https://github.com/ForestAdmin/forest-express/pull/325 thanks to @jdbdnz. You will have to update to the latest version. See: https://github.com/ForestAdmin/forest-express/blob/master/CHANGELOG.md#fixed-1

Initialization - Filter out test files when requiring models (tests/, .spec.js, .spec.ts, .test.js or *.test.ts).

Side note: Still, since ./old is not a common pattern, it will still be not ignored via our script. You could for instance move out your old repository to the root level and rename it "models-old".

Let me close this ticket, feel free to reopen it if you are still facing this issue!