【发布时间】:2016-02-26 16:25:33
【问题描述】:
查看其他问题,并不能真正找到问题的原因。我正在尝试导入一个模块并使用 mocha 对其进行测试。
import chai, {
expect
}
from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import System from 'systemjs';
import '../public/config.js';
chai.use(sinonChai);
describe('helperModule', () => {
let module;
before(function () {
return System.import('./public/js/helper.js')
.then((mod) => module = mod);
});
describe('Module loading', function () {
it('should load', function(){
expect(module.default).to.not.be.undefined;
});
});
});
运行npm test 命令时出现以下错误。
1) helperModule "before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being
called in this test.
不太确定将完成的回调放在哪里。如果您需要有关我正在使用的任何软件包的任何额外信息,我将与他们一起编辑我的问题。
【问题讨论】:
标签: javascript mocha.js