Reputation: 339
I am developing a simple web application in Meteor JS. I want to run tests using practicalmeteor:mocha so I run
meteor add practicalmeteor:mocha
and I can start the meteor app in the test mode correctly having this
The problem is I'm trying to add tests and run it but I don't know where to put it.
I created a folder in the root of the project named "tests" and put a file named test.tests.js, the file contents is:
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { assert } from 'meteor/practicalmeteor:chai';
describe('movie_db',function({
it('can view only existing movies', () => {
// Find the internal implementamtion of the task method so we can
// test it in isolation
const result = movies.find({name: "adsgfdfhggfsd"}).count();
// Verify that the method does what we expected
assert.equal(result, 0);
});
}));
but nothing happens in the page with test results, I still have 0 pass and 0 failed (As if there's no any test written).
So I need to know what should I do to run these tests.
============== Edit ===========================
it worked when I put the test in the server or the client folders. the client tests in the client folder and the server tests in the server folder.
Upvotes: 2
Views: 374
Reputation: 2729
The documentation isn't clear about this, but basically when you are testing with practicalmeteor:mocha, you want your tests saved as .tests.js but not in a /tests folder.
If they are in a /tests folder they won't be seen. Hope that helps
Upvotes: 4