Mocha for Meteor not 运行 测试记者

Mocha for Meteor not running test reporter

我的 meteor mocha test reporter 没有显示,因此我无法 运行 我的单元测试。奇怪的是 运行s describe() 而不是 it();两者都来自摩卡。

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);
});
});

我已经研究了几天了。我看过这个: Meteor 1.3 server testing 还有这个: https://github.com/practicalmeteor/meteor-mocha/issues/42

OSX 埃尔卡皮坦 10.11.3 |流星 1.3.2.4

尝试过:

感谢您提供的任何帮助。

好的,我明白了。为了将来,我不得不重新排序包文件中的包以使其工作。

.meteor/packages 下,您应该找到带有 meteortesting:mocha 的行并将其移至顶部。对我来说,把它放在 meteor 的基本库工作之后。

之前:

# 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.

meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.14                   # The database Meteor supports right now
blaze-html-templates    # Compile .html files into Meteor Blaze views
session@1.1.7                 # Client-side reactive dictionary for your app
jquery@1.11.10                  # Helpful client-side library
tracker@1.1.1                 # Meteor's client-side reactive programming library

es5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.6.1              # 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.

meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.14                   # The database Meteor supports right now
blaze-html-templates    # Compile .html files into Meteor Blaze views
session@1.1.7                 # Client-side reactive dictionary for your app
jquery@1.11.10                  # Helpful client-side library
tracker@1.1.1                 # Meteor's client-side reactive programming library

es5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.6.1              # Enable ECMAScript2015+ syntax in app code

meteortesting:mocha
pack:age
packa:ge
foo:bar
...