aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/logger.js9
-rw-r--r--lib/sendToCoveralls.js9
2 files changed, 5 insertions, 13 deletions
diff --git a/lib/logger.js b/lib/logger.js
index a847a41..f834586 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -1,19 +1,16 @@
+var index = require('../index');
+
module.exports = function(){
return require('log-driver')({level : getLogLevel()});
};
function getLogLevel(){
- if (hasVerboseCommandLineOption() || hasDebugEnvVariable()) {
+ if (index.options.verbose || hasDebugEnvVariable()) {
return 'warn';
}
return 'error';
}
-function hasVerboseCommandLineOption(){
- // look into command line arguments starting from index 2
- return process.argv.slice(2).filter(RegExp.prototype.test.bind(/^(-v|--verbose)$/)).length > 0;
-}
-
function hasDebugEnvVariable(){
return process.env.NODE_COVERALLS_DEBUG == 1;
}
diff --git a/lib/sendToCoveralls.js b/lib/sendToCoveralls.js
index 9606a08..fcf63a8 100644
--- a/lib/sendToCoveralls.js
+++ b/lib/sendToCoveralls.js
@@ -1,4 +1,5 @@
var request = require('request');
+var index = require('../index');
var sendToCoveralls = function(obj, cb){
var urlBase = 'https://coveralls.io';
@@ -9,7 +10,7 @@ var sendToCoveralls = function(obj, cb){
var str = JSON.stringify(obj);
var url = urlBase + '/api/v1/jobs';
- if (hasWriteToStdoutOption()) {
+ if (index.options.stdout) {
process.stdout.write(str);
cb(null, { statusCode: 200 }, '');
} else {
@@ -19,10 +20,4 @@ var sendToCoveralls = function(obj, cb){
}
};
-function hasWriteToStdoutOption(){
- // look into command line arguments starting from index 2
- return process.argv.slice(2).filter(RegExp.prototype.test.bind(/^(-s|--stdout)$/)).length > 0;
-}
-
-
module.exports = sendToCoveralls;