简体   繁体   中英

Meteor Testing : Mocha doesn't find all test files

I'm writing a test suite for a meteor application. I use practicalmeteor:mocha package to run the tests. Meteor tests are run using the commandline meteor test --driver-package practicalmeteor:mocha .

My tests are placed in $PROJECT/test/unit/client/ and $PROJECT/test/unit/server/ . The server tests are being identified and run, whereas client tests aren't run. Any meteor devs who faced the same problem? I know mocha allows mocha --recursive but I'm not sure how to specify that in a meteor test command.

If you mean that meteor does not even load your tests (try with an intentional syntax error in them to see if you get compilation errors) it might be that Meteor has configured itself to run tests only in some file. Eg in package.json I had

testModule: test/main.js

It seems that this causes Meteor to not follow its documented rules for finding tests and only loads this module.

Try removing this configuration to get default behaviour, or point it to your main test module (which then needs to pull in other tests).

NB. I think you should use meteortesting:mocha nowadays...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM