Move phantomas_custom to the phantomas tool directory

This commit is contained in:
Gaël Métais
2014-12-28 18:05:10 +01:00
parent e9505f31f7
commit dccb9bb49c
13 changed files with 7 additions and 7 deletions
@@ -0,0 +1,31 @@
/**
* Saves the javascript interractions with the DOM
*
* Run phantomas with --js-execution-tree option to use this module
*/
exports.version = '0.1';
exports.module = function(phantomas) {
'use strict';
phantomas.setMetric('javascriptExecutionTree'); // @desc number of duplicated DOM queries
// save data
phantomas.on('report', function() {
phantomas.log('Reading execution tree JSON');
phantomas.evaluate(function() {(function(phantomas) {
var fullTree = phantomas.readFullTree();
if (fullTree === null) {
phantomas.log('JS execution tree: error, the execution tree is not correctly closed');
return;
}
phantomas.setMetric('javascriptExecutionTree', true, true);
phantomas.addOffender('javascriptExecutionTree', JSON.stringify(fullTree));
})(window.__phantomas);});
});
};