[Solved] Tests not detected if they're in a folder called 'tests'?


#1

The short of it is, my tests are always detected when I run

meteor test --driver-package practicalmeteor:mocha

except when they’re in a folder called tests.

I’ve tried this at the project root and also at:

/tests Not found
/server/tests Not found
/import Found
/import/client Found
/import/client/tests Not Found

and so on… This seems odd. Am I missing something?


#2

Yes, legacy Meteor has constantly ignored everything in tests folder so that they don’t end up in the build.
You have to put your tests outside of the tests folders :smirk:


#3

Ohhh, yes. Of course. The new Meteor guide section on testing should really be clearer on this. It states that using the test command…

Does eagerly load any file in our application (including in imports/ folders) that look like .test[s]., or .spec[s].


#4

I actually had the opposite problem as I wanted to use karma as my test runner with es6 so someone in the forums told me to put my tests in the tests folder.

Now I run karma, webpack with Jasmine under tests and couldn’t be happier!


#5

I’m struggling to use Karma with Meteor (I’m using webpack:webpack). Is there a repository I could use as a model somewhere?


#6

I will have a look at this :wink: https://github.com/mordrax/cotwmtor/tree/master/tests


#7

yeah, not sure how you would do karma with webpack:webpack since that package kinda overrides meteor’s build system

what i’ve got under tests is ignored by meteor and the karma config has a webpack plugin that allows the tests written in ES6 to be transpiled before it’s run


#8

Well I ended up running all my tests with Chimp, end-to-end as well as “full-app unit tests” thanks to their amazing server.execute() feature. Using a single tool for all the tests is really great.


#9

Just spent half a day on this. That kind of quirks must be fixed asap I think. It’s really ugly design and at the very least it should be mentioned in bold in documentation because people now unnecessarily waste time and meteor is suddenly not that productive anymore.