Mocha Test Doesn't Work with Tea Approval Using Meteor

In my project, I'm trying to configure Mocha to run Chai tests, but I have a problem when the tests just don't work. The browser reports that no tests pass, fail, or fail.

Here is the code for the tests:

import {assert} from 'chai'; import {Meteor} from 'meteor/meteor'; if (Meteor.isclient) { describe('Recipe model', function () { it('should test that a recipe is created', function () { assert.isTrue(true); }); }); } 

I run the test using the following command:

  meteor test --driver-package practicalmeteor:mocha 

I installed a practical meteorite: chai as well. A google search suggested putting chai.should () at the beginning of my test, but that didn't help. I am open to all suggestions.

Hooray!

+5
source share
3 answers

Turns out I had weird issues with importing assert. I just needed to do the following, as pointed out by @Tdm:

 import {chai} from 'meteor/practicalmeteor:chai' 
0
source

One possible problem is a typo on the 4th line of your code: replace Meteor.isclient with Meteor.isclient . Your test did not even run because Meteor.isclient always false .

+1
source

Make sure you do not put the test file in the / tests directory. I know this is not intuitive, but the meteor ignores everything inside / tests.

+1
source

All Articles