Reputation: 93
My meteor mocha test reporter is not showing up, therefor I can't run my unit tests. What's odd is it runs describe() but not it(); both are from Mocha.
console.log('Hello World!'); //this works
import { chai } from 'meteor/practicalmeteor:chai';
describe('Meteor Methods', function () {
console.log('inside describe function!'); // this works
// console.log('it: '+it);
/*
function (name, func) {
I20160613-16:50:40.062(-6)? // You can create pending tests without a function //
I20160613-16:50:40.062(-6)? // http://mochajs.org/#pending-tests //
I20160613-16:50:40.063(-6)? // i.e pending test //
I20160613-16:50:40.063(-6)? // it('this is a pending test'); //
I20160613-16:50:40.063(-6)? if (func) { // 57
I20160613-16:50:40.063(-6)? func = wrapRunnable(func); // 58
I20160613-16:50:40.063(-6)? } //
I20160613-16:50:40.063(-6)? mochaExports["__org_it"](name, func); // 60
I20160613-16:50:40.063(-6)? }
*/
it('unit test I want to work 1', function () {
console.log('before assertion WIN'); // this doesn't work
chai.assert.equal(-1, [1,2,3].indexOf(5));
})
it('unit test 2'); //pending test doesn't work
console.log('after it'); //this works
});
describe("foo", function() {
console.log('inside second suite'); //this works
it("bar", function() {
console.log('hello?'); // this doesn't
expect(1+1).to.equal(2);
});
});
I've been on this for a couple of days. I've seen this: Meteor 1.3 server testing and this: https://github.com/practicalmeteor/meteor-mocha/issues/42
OSX El Capitan 10.11.3 | Meteor 1.3.2.4
Tried:
avital:[email protected]_10 (https://themeteorchef.com/blog/meteor-1-3-from-a-20-000-foot-view/)
practicalmeteor:[email protected] (https://forums.meteor.com/t/meteor-test-not-running-some-tests-and-not-throwing-errors/21232/3)
having the tests inside and outside the tests directory
adding ES6 support
using phantom instead
replicating the todo app (working unit tests)
replicating this repo with working unit tests
copying every package to make it work
Thanks for any help you may provide.
Upvotes: 2
Views: 706
Reputation: 93
Ok, I figured it out. For the future, I had to reorder the packages in the packages file to make it work.
Under the .meteor/packages
, you should find the line with meteortesting:mocha
and move it to the top. For me, placing it right after meteor's basic libraries worked.
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected] # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
[email protected] # Client-side reactive dictionary for your app
[email protected] # Helpful client-side library
[email protected] # Meteor's client-side reactive programming library
[email protected] # ECMAScript 5 compatibility for older browsers.
[email protected] # Enable ECMAScript2015+ syntax in app code
pack:age
packa:ge
foo:bar
...
meteortesting:mocha
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected] # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
[email protected] # Client-side reactive dictionary for your app
[email protected] # Helpful client-side library
[email protected] # Meteor's client-side reactive programming library
[email protected] # ECMAScript 5 compatibility for older browsers.
[email protected] # Enable ECMAScript2015+ syntax in app code
meteortesting:mocha
pack:age
packa:ge
foo:bar
...
Upvotes: 1