lundi 25 avril 2016

Mocha Test #getImpact "before all" hook: Error: timeout of 2000ms exceeded

I want to test a module which runs a jar file and gives me back a result.

The problem is that the jar file is bound to take about 5 minutes to execute and give the result, because of which I get the error

Callgraph_class_traversal #getImpact "before all" hook: Error: timeout of 2000ms exceeded

My testing code is

describe("Callgraph_class_traversal", function() {

describe("#getImpact", function() {

var gerritData
var revert;
var result;

var resMock = function() {};

var updateDatabaseMock = function(res, _gerritData) {
  gerritData = _gerritData;
  res();
};

before(function(done) {
  callgraph_class_traversal.__set__({
    updateDatabase: updateDatabaseMock,
    up: upMock
  });
  callgraph_class_traversal.getImpact(methodsChanged, done, gerritId);
});

it('should get correct api paths', function() {
  assert.deepEqual(gerritData.apiResult.paths, expectedGerritData.apiResult.paths);
});

it('should get correct api objects', function() {
  assert.deepEqual(gerritData.apiResult.names, expectedGerritData.apiResult.names);
});

it('should get correct cts paths', function() {
  assert.deepEqual(gerritData.ctsResult.paths, expectedGerritData.ctsResult.paths);
});

it('should get correct cts names', function() {
  assert.deepEqual(gerritData.ctsResult.names, expectedGerritData.ctsResult.names);
});     

after(function() {
//      revert();
});

});
});

callgraph_class_traversal is the module which I want to test.

I am using rewire and assert to test my code.

Please help me with this

Aucun commentaire:

Enregistrer un commentaire