This repository was archived by the owner on Feb 19, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Expand file tree Collapse file tree 5 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 22 'use strict' ;
33
44 var optionsValidation = Joi . object ( {
5- endpoint : Joi . string ( ) . min ( 1 ) . optional ( ) . example ( 'https://codacy.com/coverage/:token/:commitId ' )
5+ endpoint : Joi . string ( ) . min ( 1 ) . optional ( ) . example ( 'https://codacy.com/api/2.0/ coverage/:commitId/:language ' )
66 } ) ;
77 var tokenValidation = Joi . string ( ) . required ( ) . min ( 1 ) . example ( '1234567890' ) ; //TODO: Revisit this validation to see if we can better validate the values
88 var commitIdValidation = Joi . string ( ) . required ( ) . min ( 1 ) . example ( '1234567890' ) ; //TODO: Revisit this validation to see if we can better validate the values
2626 throw optionsValid . error ;
2727 }
2828
29- var endpoint = options . endpoint || 'https://www.codacy.com/api/coverage/:token/: commitId' ;
29+ var endpoint = options . endpoint || 'https://www.codacy.com/api/2.0/ coverage/:commitId/javascript ' ;
3030 logger . debug ( 'Setting up reporter communicating to: ' + endpoint ) ;
3131
3232 return {
4545 return reject ( validationErr ) ;
4646 }
4747
48- var url = endpoint . replace ( ':token' , token ) . replace ( ': commitId', commitId ) ;
48+ var url = endpoint . replace ( ':commitId' , commitId ) ;
4949 logger . trace ( util . format ( 'Sending POST to %s' , url ) ) ;
5050
5151 return request ( {
5252 url : url ,
5353 method : 'POST' ,
5454 json : data ,
55+ headers : {
56+ // jscs:disable
57+ 'project_token' : token
58+ // jscs:enable
59+ } ,
5560 resolveWithFullResponse : true
5661 } ) . then ( function ( res ) {
5762 if ( res . statusCode !== 200 ) {
Original file line number Diff line number Diff line change 11{
22 "name" : " codacy-coverage" ,
3- "version" : " 1.1.1 " ,
3+ "version" : " 1.1.2 " ,
44 "description" : " Code Coverage reporter for Codacy.com" ,
55 "keywords" : [
66 " codacy" ,
Original file line number Diff line number Diff line change 4040 return helper . setupMockEndpoint ( '1234' , '4321' , bodyValidator )
4141 . then ( function ( ) {
4242 return expect ( request ( {
43- url : 'https://www.codacy.com/api/coverage/1234/ 4321' ,
43+ url : 'https://www.codacy.com/api/2.0/ coverage/4321/javascript ' ,
4444 method : 'POST' ,
4545 json : sampleCoverageData ,
4646 resolveWithFullResponse : true
Original file line number Diff line number Diff line change 1717 expect ( bodyValidator ) . to . be . ok ( ) ;
1818
1919 return resolve ( nock ( 'https://www.codacy.com' )
20- . post ( '/api/coverage/' + token + '/' + commitId , function ( body ) {
20+ . post ( '/api/2.0/ coverage/' + commitId + '/javascript' , function ( body ) {
2121 var result = bodyValidator . validate ( body ) ;
2222 return result . error ? false : true ;
2323 } )
Original file line number Diff line number Diff line change 3939 return helper . setupMockEndpoint ( '1234' , '4321' , bodyValidator )
4040 . then ( function ( ) {
4141 return expect ( request ( {
42- url : 'https://www.codacy.com/api/coverage/1234/ 4321' ,
42+ url : 'https://www.codacy.com/api/2.0/ coverage/4321/javascript ' ,
4343 method : 'POST' ,
4444 json : sampleCoverageData ,
4545 resolveWithFullResponse : true
You can’t perform that action at this time.
0 commit comments