Fix tests
This commit is contained in:
+17
-13
@@ -6,6 +6,8 @@ var rulesChecker = require('./rulesChecker');
|
||||
var Runner = function(params) {
|
||||
'use strict';
|
||||
|
||||
var deferred = Q.defer();
|
||||
|
||||
// The pivot format
|
||||
var data = {
|
||||
params: params,
|
||||
@@ -13,26 +15,28 @@ var Runner = function(params) {
|
||||
};
|
||||
|
||||
// Execute Phantomas first
|
||||
var run = phantomasWrapper.execute(data);
|
||||
phantomasWrapper.execute(data).then(function(phantomasResults) {
|
||||
data.toolsResults.phantomas = phantomasResults;
|
||||
|
||||
// Other tools go here
|
||||
// Other tools go there
|
||||
|
||||
|
||||
// Read each policy and save the results
|
||||
run.then(function() {
|
||||
// Rules checker
|
||||
var policies = require('./metadata/policies.json');
|
||||
return rulesChecker.check(data, policies);
|
||||
data.rules = rulesChecker.check(data, policies);
|
||||
|
||||
|
||||
deferred.resolve(data);
|
||||
|
||||
}).fail(function(err) {
|
||||
console.log('Run failed');
|
||||
console.log(err);
|
||||
|
||||
deferred.reject(err);
|
||||
});
|
||||
|
||||
// TODO : error handler
|
||||
/*run.catch(function(err) {
|
||||
console.log('The run failed');
|
||||
console.log(err);
|
||||
});*/
|
||||
|
||||
run.done(data);
|
||||
|
||||
return run;
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
module.exports = Runner;
|
||||
Reference in New Issue
Block a user