Skip to content

Commit

Permalink
Allow asserts to be provided via CLI options
Browse files Browse the repository at this point in the history
Resolves #128
  • Loading branch information
macbre committed Nov 23, 2013
1 parent f19c1f0 commit 20c317f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/phantomas.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@ var phantomas = function(params) {
this.results.setUrl(this.url);
this.results.setAsserts(this.params.asserts);

// allow asserts to be provided via command-line options (#128)
Object.keys(this.params).forEach(function(param) {
var value = parseFloat(this.params[param]),
name;

if (!isNaN(value) && param.indexOf('assert-') === 0) {
name = param.substr(7);

if (name.length > 0) {
this.results.setAssert(name, value);
}
}
}, this);

// load core modules
this.log('Loading core modules...');
this.addCoreModule('requestsMonitor');
Expand Down

0 comments on commit 20c317f

Please sign in to comment.