Open Gobliins opened 7 years ago
I read on the README.md
at https://github.com/practicalmeteor/meteor-mocha that
We do not support writing mocha tests for your app's code. Only code in packages can be tested with this package.
I'm not totally sure what they mean by package, but I think it means you are not supposed to be able to run tests using vanilla mocha as well as the practicalmeteor:mocha driver. It's one or the other. Try moving your tests out of the \test
folder and into your imports
folder and see if that makes a difference.
So basically, the whole section in "App testing with meteor test" is phony... wth? So what would be the alternative mike:mocha ?
No not phony at all! If you want to use Mocha with Meteor you have to either use the meteor test
command with the practicalmeteor:mocha driver
and write tests named *.test.js
amongst your application files (which is what I am doing). I don't think (and I am not 100% on this since I have not done it) mike:mocha will work properly on those tests. If you want to use mike:mocha, you'll need to put your tests in a /tests
folder and run mike:mocha the way you would for any normal JS project - but of course, you'd have to stub out any meteor dependencies in that code. You would typically only want to use mike:mocha for testing non-meteor related stuff in your app. There is also another option for meteor testing: https://github.com/meteortesting/meteor-mocha
.
Good luck. It has taken me quite a while to get to grips with testing Meteor.
meteor test command with the practicalmeteor:mocha driver and write tests named *.test.js
I did exactly this.
Good luck. It has taken me quite a while to get to grips with testing Meteor.
Same here, main problem is that i use a webdriver for node which doesn't know anything about meteor, but this is unrelated to the current problem here.
also i read they want to reorganize meteor to become a node module which would simplify lots of things.
Maybe related, but I've noticed that if I put my *.test.js
file in /imports/tests/test.test.js
it is not run, whereas it is run if in /imports/test.test.js
... or maybe related to #56
@abate, I suspect that is exactly what the issue that @Gobliins is facing. Well spotted.
That's why i made an extra dir called /test
not /tests
, well i am going to check, what happens if i move the tests in the import directory.
I have a /test and a /tests directory and my test files follow the *.test.js convention. Still when i run:
meteor test --driver-package practicalmeteor:mocha
no test is executed...The tests run when i use mocha --recursive tests