practicalmeteor / meteor-mocha

Depreciated - Write meteor package tests with mocha and run them in the browser or from the command line with spacejam.
https://atmospherejs.com/practicalmeteor/mocha
Other
41 stars 13 forks source link

doesn't run tests #97

Open Gobliins opened 7 years ago

Gobliins commented 7 years ago

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

charlesdeb commented 6 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.

Gobliins commented 6 years ago

So basically, the whole section in "App testing with meteor test" is phony... wth? So what would be the alternative mike:mocha ?

charlesdeb commented 6 years ago

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.

Gobliins commented 6 years ago

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.

abate commented 6 years ago

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

charlesdeb commented 6 years ago

@abate, I suspect that is exactly what the issue that @Gobliins is facing. Well spotted.

Gobliins commented 6 years ago

That's why i made an extra dir called /testnot /tests , well i am going to check, what happens if i move the tests in the import directory.