确保在此测试中调用 done() 回调(Mocha、Chai、Sinon)

Ensure the done() callback is being called in this test (Mocha, Chai, Sinon)

看了其他问题,实在找不到问题的原因。我正在尝试导入一个模块并使用 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.

不太确定将完成的回调放在哪里。如果您需要有关我正在使用的任何软件包的任何额外信息,我将与他们一起编辑我的问题。

期望在测试完成时调用 done() 回调。一些库会隐式地为您执行此操作,您也可以将 done 传递给其他将在成功时调用它的函数。如果您需要手动完成,可以将 done 指定为您的测试函数的参数,以便稍后调用。

describe('Module loading', function () {
    it('should load', function(done){
        expect(module.default).to.not.be.undefined;
        done();
    });
});