Skip to content

Commit b8f043a

Browse files
committed
Load config only when required
Enables unit testing of functions without having browserstack.json
1 parent c31790a commit b8f043a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var Log = require('./logger'),
22
logger = new Log(global.logLevel),
3-
config = require('./config'),
43
http = require('http'),
54
url = require('url'),
6-
querystring = require('querystring');
5+
querystring = require('querystring'),
6+
config;
77

88
String.prototype.escapeSpecialChars = function() {
99
return this.replace(/\n/g, '\\n')
@@ -51,6 +51,10 @@ var objectSize = function objectSize(obj) {
5151
};
5252

5353
var alertBrowserStack = function alertBrowserStack(subject, content, params, fn) {
54+
if (!config) {
55+
config = require('./config');
56+
}
57+
5458
var endpoint = config.alert_endpoint || 'http://www.browserstack.com/automate/alert';
5559
var urlObject = url.parse(endpoint);
5660

0 commit comments

Comments
 (0)