[Pkg-javascript-commits] [node-coveralls] 137/332: Read service_name from coveralls.yml

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:53:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit 2275311f3a1b9125993686161d76aa54e087705b
Author: Gerard Escalante <gerard at saygo.ca>
Date:   Tue Feb 11 13:16:07 2014 +0900

    Read service_name from coveralls.yml
    
    Also fixed a typo from the last commit.
---
 lib/getOptions.js  |  6 +++++-
 test/getOptions.js | 14 +++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lib/getOptions.js b/lib/getOptions.js
index 53b50b4..3641ffc 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -59,7 +59,11 @@ var getBaseOptions = function(cb){
     var yml = path.join(process.cwd(), '.coveralls.yml');
     try {
       if (fs.statSync(yml).isFile()) {
-        options.repo_token = yaml.safeLoad(fs.readFileSync(yml, 'utf8')).repo_token;
+        var coveralls_yaml_conf = yaml.safeLoad(fs.readFileSync(yml, 'utf8'));
+        options.repo_token = coveralls_yaml_conf.repo_token;
+        if(coveralls_yaml_conf.service_name) {
+          options.service_name = coveralls_yaml_conf.service_name;
+        }
       }
     } catch(ex){
       logger.warn("Repo token could not be determined.  Continuing without it.");
diff --git a/test/getOptions.js b/test/getOptions.js
index 2fc7be0..fc33012 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -197,17 +197,25 @@ var testRepoTokenDetection = function(sut, done) {
   var fs = require('fs');
   var path = require('path');
 
-  var file = path.join(process.cwd(), '.coveralls.yml'), token, synthetic = false;
+  var file = path.join(process.cwd(), '.coveralls.yml'), token, service_name, synthetic = false;
   if (fs.exists(file)) {
     var yaml = require('js-yaml');
-    token = yaml.saveLoad(fs.readFileSync(yml, 'utf8')).repo_token;
+    var coveralls_yml_doc = yaml.safeLoad(fs.readFileSync(yml, 'utf8'));
+    token = coveralls_yml_doc.repo_token;
+    if(coveralls_yml_doc.service_name) {
+      service_name = coveralls_yml_doc.service_name;
+    }
   } else {
     token = 'REPO_TOKEN';
-    fs.writeFileSync(file, 'repo_token: ' + token);
+    service_name = 'travis-pro';
+    fs.writeFileSync(file, 'repo_token: ' + token+'\nservice_name: ' + service_name);
     synthetic = true;
   }
   sut(function(err, options) {
     options.repo_token.should.equal(token);
+    if(service_name) {
+      options.service_name.should.equal(service_name);
+    }
     if (synthetic)
       fs.unlink(file);
     done();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list