Skip to content

Instantly share code, notes, and snippets.

@jcleveley-zz
Created October 6, 2014 09:01
Show Gist options
  • Save jcleveley-zz/41f75e003a1a31366eb0 to your computer and use it in GitHub Desktop.
Save jcleveley-zz/41f75e003a1a31366eb0 to your computer and use it in GitHub Desktop.
var phantomas = require('phantomas');
var run;
var options = {
"reporter": "tap"
};
console.log('phantomas v%s loaded from %s', phantomas.version, phantomas.path);
run = phantomas('http://pal.live.bbc.co.uk/news', options);
// errors handling
run.on('error', function(code) {
console.log('Exit code #%d', code);
});
// handle results
run.on('results', function(results) {
reporter = require('./node_modules/phantomas/core/reporter')(results, options);
res = reporter.render();
console.log(res);
});
// events handling
run.on('progress', function(progress) {
console.log('.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment