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

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?

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:

1 Like

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].

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!

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

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

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

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.

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.