Unit testing 摩卡为流星不运行测试报告
我的meteor mocha没有出现,因此我无法运行单元测试。奇怪的是它运行的是descripe()而不是it();两人都来自摩卡Unit testing 摩卡为流星不运行测试报告,unit-testing,meteor,mocha.js,Unit Testing,Meteor,Mocha.js,我的meteor mocha没有出现,因此我无法运行单元测试。奇怪的是它运行的是descripe()而不是it();两人都来自摩卡 console.log('Hello World!'); //this works import { chai } from 'meteor/practicalmeteor:chai'; describe('Meteor Methods', function () { console.log('inside describe function!'); //
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);
});
});
这件事我已经谈了好几天了。我看到了:
这是:
OSX El Capitan 10.11.3 |流星1.3.2.4
尝试:
- avital:mocha@2.1.0_10()
- 实习医生:mocha@2.4.6-rc.2()
- 在tests目录内外进行测试
- 添加ES6支持
- 改用幻影
- 复制(工作单元测试)
- 使用工作单元测试进行复制
- 复制每个包以使其正常工作
谢谢你提供的任何帮助 好吧,我想出来了。对于未来,我必须在packages文件中重新排序包,以使其正常工作 在
.meteor/packages
下,您应该找到带有meteortesting:mocha
的行,并将其移到顶部。对我来说,把它放在meteor的基本库工作之后
之前:
之后:
你能详细说明一下你具体做了什么来修复这个问题吗?哦,伙计,这是很久以前的事了,但据我所知,有一些包相互依赖,所以我在包文件中对它们重新排序。特别是摩卡套餐,可能还有另一个测试套餐,比如Chai。一旦它们按正确的顺序排列,效果就很好了。
# 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
...