Shyyk Shyyk - 28 days ago 6
Javascript Question

Mocha test not running Chai assertion using Meteor

For my project, I am trying to set up Mocha to run Chai tests, but am having an issue where the tests are simply not running at all. The browser reports that no tests are passing, failing, or running.

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 have installed practicalmeteor:chai as well. A google search suggested putting chai.should() at the beginning of my test, but that did not help. I am open to all suggestions.

Cheers!

Answer

Turns out I had weird issues with importing assert. I just had to do the following as noted from @Tdm:

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