@@ -170,6 +170,9 @@ describe('getOptions', () => {
170
170
it ( 'should set service_name and service_job_id if it\'s running via Azure Pipelines' , done => {
171
171
testAzurePipelines ( getOptions , done ) ;
172
172
} ) ;
173
+ it ( 'should set service_name and service_job_id if it\'s running via CodeFresh' , done => {
174
+ testCodefresh ( getOptions , done ) ;
175
+ } ) ;
173
176
it ( 'should override set options with user options' , done => {
174
177
const userOptions = { service_name : 'OVERRIDDEN_SERVICE_NAME' } ;
175
178
process . env . COVERALLS_SERVICE_NAME = 'SERVICE_NAME' ;
@@ -665,6 +668,37 @@ const testAzurePipelines = (sut, done) => {
665
668
} ) ;
666
669
} ;
667
670
671
+ const testCodefresh = ( sut , done ) => {
672
+ process . env . CF_BRANCH = 'hotfix' ;
673
+ process . env . CF_REVISION = 'e3e3e3e3e3e3e3e3e' ;
674
+ process . env . CF_BUILD_ID = '1234' ;
675
+ process . env . CF_COMMIT_AUTHOR = 'john doe' ;
676
+ process . env . CF_COMMIT_MESSAGE = 'msgmsgmsg' ;
677
+ process . env . CF_PULL_REQUEST_ID = '3' ;
678
+
679
+ const git = {
680
+ head : {
681
+ id : 'e3e3e3e3e3e3e3e3e' ,
682
+ author_name : 'Unknown Author' ,
683
+ author_email : '' ,
684
+ committer_name : 'john doe' ,
685
+ committer_email : '' ,
686
+ message : 'msgmsgmsg'
687
+ } ,
688
+ branch : 'hotfix' ,
689
+ remotes : [ ]
690
+ } ;
691
+
692
+ sut ( ( err , options ) => {
693
+ should . not . exist ( err ) ;
694
+ options . service_name . should . equal ( 'Codefresh' ) ;
695
+ options . service_job_id . should . equal ( '1234' ) ;
696
+ options . service_pull_request . should . equal ( '3' ) ;
697
+ options . git . should . eql ( git ) ;
698
+ done ( ) ;
699
+ } ) ;
700
+ } ;
701
+
668
702
function ensureLocalGitContext ( options ) {
669
703
const baseDir = process . cwd ( ) ;
670
704
let dir = baseDir ;
0 commit comments