I’m using Jest from my React & non-Meteor specific testing and have been using meteortesting:mocha for my server side tests however I’m having an issue where meteortesting:mocha want’s to load up anything and everything with .test.js is there any way I can tell the Meteor build to to ignore certain folders while testing? Anyone have an ideas on what the best way to approach this would be? I’m open to alternate solutions that don’t involve me dropping Jest from non-Meteor tests.
Here is my dumb solution. I was able to configure Jest’s testmatch. Since Meteor is looking for test, tests, spec, specs, I went with “testz” with Jest, which is dumb… but it works. I’d prefer better test matching settings for Meteor’s build tool itself.
Does meteor load up tests in a
/tests/ folder as well?
The docs say that it shouldn’t:
Any directory named tests/ is not loaded anywhere. Use this for any test code you want to run using a test runner outside of Meteor’s built-in test tools.
I prefer to keep my tests in the same folder as the file it’s testing. Having a separate tests folder would require you to maintain two separate but similar folder structures and add a lot of unneeded complexity to the file structure.
I think it is possible to have, but this still may not be what you want:
app/myModule/myModule.js app/myModule/myModule.tests.js // executed by `meteor test` command app/myModule/tests/myModule.tests.js // not exectued by `meteor test` command
but I have not “tested” to confirm…
Not a bad idea. I’ll have to try this out.