dev.to hasn’t had too many posts on Meteor, so I’ve been inspired to help spread some word over there, and I posted this:
Interesting take. I can’t help but express my complaints about testing with Meteor. Specifically, I can’t figure out why Meteor uses the test-app
script name to execute the --full-app
flag that applies to the *.app-test[s].*
file naming pattern. It also says in the docs the /tests
folder naming pattern is designed for non-Meteor tests and is thusly ignored by the meteor test
command, however this can apparently be overrided by the meteor.testModule
property in package.json, which exactly what newly created Meteor apps do with /tests/main.js
, which itself overrides the test[s]/spec[s] + app-test[s]/app-spec[s] filenaming patterns, at which point you would apparently need to treat tests using a single point of entry pattern rather than a filenaming pattern, none of which is configurable.
Phew.
Haha, that was funny. You could totally rename that script anyways.
Haha, that’s great you know all that. I had no idea. Funny how you wrote a run-on sentence about it all.
By the way, I like to have test files be co-located with source files. Do you know how one would configure that?
The files might be like this:
client/foo.js
client/foo.test.js
Yep dev.to has very few Meteor content. I have written articles from time to time but I think we as community should be much more present there
The filenaming pattern is the default behavior, so you can colocate tests with files like you described, however as far as I can tell it won’t run those tests if you have meteor.testModule
set in package.json
, so you would have to import those test files through the test module. If you want to use the filenaming pattern, I think you have to remove testModule. I’m not sure if it’s configurable but I haven’t heard of a way to do that.