From bd667c617bbf5ff921f6b3734a991cde874db320 Mon Sep 17 00:00:00 2001 From: Manu Phatak Date: Tue, 1 May 2018 15:51:15 -0500 Subject: Add Semaphore support (#180) Semaphore ENV variables: https://semaphoreci.com/docs/available-environment-variables.html --- test/getOptions.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/getOptions.js b/test/getOptions.js index 51e4fa0..6e8d898 100644 --- a/test/getOptions.js +++ b/test/getOptions.js @@ -143,6 +143,9 @@ describe("getOptions", function(){ it ("should set service_name and service_job_id if it's running via Surf", function(done){ testSurf(getOptions, done); }); + it ("should set service_name and service_job_id if it's running via Semaphore", function(done){ + testSemaphore(getOptions, done); + }); it ("should override set options with user options", function(done){ var userOptions = {service_name: 'OVERRIDDEN_SERVICE_NAME'}; process.env.COVERALLS_SERVICE_NAME = "SERVICE_NAME"; @@ -446,6 +449,28 @@ var testSurf = function(sut, done) { }); }; +var testSemaphore = function(sut, done) { + process.env.SEMAPHORE = true; + process.env.SEMAPHORE_BUILD_NUMBER = '1234'; + process.env.REVISION = "e3e3e3e3e3e3e3e3e"; + process.env.BRANCH_NAME = "master"; + + sut(function(err, options){ + options.service_name.should.equal("semaphore"); + 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'); -- cgit v1.2.3