[Pkg-javascript-commits] [node-coveralls] 190/332: Add Wercker CI support with tests.

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:53:59 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 6472650604c7649f8a1156fa4dcd63a7f9289b38
Author: Steven Weathers <steven at weathers.me>
Date:   Tue Nov 4 19:16:46 2014 -0500

    Add Wercker CI support with tests.
    
    Fix minor lint error where a second semicolon appears in lib/fetchGitData.js
---
 lib/fetchGitData.js |  2 +-
 lib/getOptions.js   |  7 +++++++
 test/getOptions.js  | 27 +++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/lib/fetchGitData.js b/lib/fetchGitData.js
index 3bebda3..67b6190 100644
--- a/lib/fetchGitData.js
+++ b/lib/fetchGitData.js
@@ -59,7 +59,7 @@ function fetchBranch(git, cb) {
   });
 }
 
-var REGEX_COMMIT_DETAILS = /\nauthor (.+?) <(.+?)>.+\ncommitter (.+?) <(.+?)>.+\n?[\S\s]+?\n\n(.*)/m;;
+var REGEX_COMMIT_DETAILS = /\nauthor (.+?) <(.+?)>.+\ncommitter (.+?) <(.+?)>.+\n?[\S\s]+?\n\n(.*)/m;
 
 function fetchHeadDetails(git, cb) {
   exec('git cat-file -p ' + git.head.id, function(err, response) {
diff --git a/lib/getOptions.js b/lib/getOptions.js
index b5e041f..eab67f4 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -46,6 +46,13 @@ var getBaseOptions = function(cb){
     git_branch = process.env.CI_BRANCH;
   }
 
+  if (process.env.WERCKER){
+    options.service_name = 'wercker';
+    options.service_job_id = process.env.WERCKER_BUILD_ID;
+    git_commit = process.env.WERCKER_GIT_COMMIT;
+    git_branch = process.env.WERCKER_GIT_BRANCH;    
+  }
+
   options.run_at = process.env.COVERALLS_RUN_AT || JSON.stringify(new Date()).slice(1, -1);
   if (process.env.COVERALLS_SERVICE_NAME){
     options.service_name = process.env.COVERALLS_SERVICE_NAME;
diff --git a/test/getOptions.js b/test/getOptions.js
index 1d3c6d1..8a77708 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -54,6 +54,9 @@ describe("getBaseOptions", function(){
     testDrone(getBaseOptions, done);
   });
   */
+  it ("should set service_name and service_job_id if it's running on wercker", function(done){
+    testWercker(getBaseOptions, done);
+  });
 });
 
 describe("getOptions", function(){
@@ -129,6 +132,9 @@ describe("getOptions", function(){
     testDrone(getBaseOptions, done);
   });
   */
+  it ("should set service_name and service_job_id if it's running on wercker", function(done){
+    testWercker(getOptions, done);
+  });
 });
 
 var testServiceJobId = function(sut, done){
@@ -334,6 +340,27 @@ var testDrone = function(sut, done) {
   });
 };
 
+var testWercker = function(sut, done) {
+  process.env.WERCKER = true;
+  process.env.WERCKER_BUILD_ID = '1234';
+  process.env.WERCKER_GIT_COMMIT = "e3e3e3e3e3e3e3e3e";
+  process.env.WERCKER_GIT_BRANCH = "master";
+  sut(function(err, options){
+    options.service_name.should.equal("wercker");
+    options.service_job_id.should.equal("1234");
+    options.git.should.eql({ head:
+                               { id: 'e3e3e3e3e3e3e3e3e',
+                                 author_name: 'Unknown Author',
+                                 author_email: '',
+                                 committer_name: 'Unknown Committer',
+                                 committer_email: '',
+                                 message: 'Unknown Commit Message' },
+                              branch: 'master',
+                              remotes: [] });
+    done();
+  });
+};
+
 function ensureLocalGitContext(options) {
   var path = require('path');
   var fs = require('fs');

-- 
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