@@ -82,12 +82,12 @@ const defaults: {
82
82
version : '0.0.0' ,
83
83
} ;
84
84
85
- /* istanbul ignore next */
85
+ /* v8 ignore start */
86
86
function updatePrVersion ( pr : number , version : number ) : number {
87
87
const res = Math . max ( config . prVersions . get ( pr ) ?? 0 , version ) ;
88
88
config . prVersions . set ( pr , res ) ;
89
89
return res ;
90
- }
90
+ } /* v8 ignore stop */
91
91
92
92
export async function initPlatform ( {
93
93
endpoint,
@@ -116,10 +116,10 @@ export async function initPlatform({
116
116
} ;
117
117
try {
118
118
let bitbucketServerVersion : string ;
119
- // istanbul ignore if : experimental feature
119
+ /* v8 ignore start : experimental feature */
120
120
if ( process . env . RENOVATE_X_PLATFORM_VERSION ) {
121
121
bitbucketServerVersion = process . env . RENOVATE_X_PLATFORM_VERSION ;
122
- } else {
122
+ } /* v8 ignore stop */ else {
123
123
const { version } = (
124
124
await bitbucketServerHttp . getJsonUnchecked < { version : string } > (
125
125
`./rest/api/1.0/application-properties` ,
@@ -193,10 +193,10 @@ export async function getRepos(): Promise<string[]> {
193
193
const result = repos . map ( ( repo ) => `${ repo . project . key } /${ repo . slug } ` ) ;
194
194
logger . debug ( { result } , 'result of getRepos()' ) ;
195
195
return result ;
196
- } catch ( err ) /* istanbul ignore next */ {
196
+ } catch ( err ) /* v8 ignore start */ {
197
197
logger . error ( { err } , `bitbucket getRepos error` ) ;
198
198
throw err ;
199
- }
199
+ } /* v8 ignore stop */
200
200
}
201
201
202
202
export async function getRawFile (
@@ -296,7 +296,7 @@ export async function initRepo({
296
296
} ;
297
297
298
298
return repoConfig ;
299
- } catch ( err ) /* istanbul ignore next */ {
299
+ } catch ( err ) /* v8 ignore start */ {
300
300
if ( err . statusCode === 404 ) {
301
301
throw new Error ( REPOSITORY_NOT_FOUND ) ;
302
302
}
@@ -306,7 +306,7 @@ export async function initRepo({
306
306
307
307
logger . debug ( { err } , 'Unknown Bitbucket initRepo error' ) ;
308
308
throw err ;
309
- }
309
+ } /* v8 ignore stop */
310
310
}
311
311
312
312
export async function getBranchForceRebase (
@@ -353,7 +353,7 @@ export async function getPr(
353
353
}
354
354
355
355
// TODO: coverage (#9624)
356
- // istanbul ignore next
356
+ /* v8 ignore start */
357
357
function matchesState ( state : string , desiredState : string ) : boolean {
358
358
if ( desiredState === 'all' ) {
359
359
return true ;
@@ -362,21 +362,25 @@ function matchesState(state: string, desiredState: string): boolean {
362
362
return state !== desiredState . substring ( 1 ) ;
363
363
}
364
364
return state === desiredState ;
365
- }
365
+ } /* v8 ignore stop */
366
366
367
367
// TODO: coverage (#9624)
368
- // istanbul ignore next
369
- const isRelevantPr =
370
- ( branchName : string , prTitle : string | null | undefined , state : string ) =>
371
- ( p : Pr ) : boolean =>
368
+ /* v8 ignore start */
369
+ function isRelevantPr (
370
+ branchName : string ,
371
+ prTitle : string | null | undefined ,
372
+ state : string ,
373
+ ) {
374
+ return ( p : Pr ) : boolean =>
372
375
p . sourceBranch === branchName &&
373
376
( ! prTitle || p . title . toUpperCase ( ) === prTitle . toUpperCase ( ) ) &&
374
377
matchesState ( p . state , state ) ;
378
+ } /* v8 ignore stop */
375
379
376
380
// TODO: coverage (#9624)
381
+ /* v8 ignore start */
377
382
export async function getPrList ( refreshCache ?: boolean ) : Promise < Pr [ ] > {
378
383
logger . debug ( `getPrList()` ) ;
379
- // istanbul ignore next
380
384
if ( ! config . prList || refreshCache ) {
381
385
const searchParams : Record < string , string > = {
382
386
state : 'ALL' ,
@@ -399,10 +403,10 @@ export async function getPrList(refreshCache?: boolean): Promise<Pr[]> {
399
403
logger . debug ( 'returning cached PR list' ) ;
400
404
}
401
405
return config . prList ;
402
- }
406
+ } /* v8 ignore stop */
403
407
404
408
// TODO: coverage (#9624)
405
- // istanbul ignore next
409
+ /* v8 ignore start */
406
410
export async function findPr ( {
407
411
branchName,
408
412
prTitle,
@@ -447,7 +451,7 @@ export async function findPr({
447
451
logger . debug ( `Renovate did not find a PR for branch #${ branchName } ` ) ;
448
452
}
449
453
return pr ?? null ;
450
- }
454
+ } /* v8 ignore stop */
451
455
452
456
// Returns the Pull Request for a branch. Null if not exists.
453
457
export async function getBranchPr ( branchName : string ) : Promise < BbsPr | null > {
@@ -459,13 +463,13 @@ export async function getBranchPr(branchName: string): Promise<BbsPr | null> {
459
463
return existingPr ? getPr ( existingPr . number ) : null ;
460
464
}
461
465
462
- // istanbul ignore next
466
+ /* v8 ignore start */
463
467
export async function refreshPr ( number : number ) : Promise < void > {
464
468
// wait for pr change propagation
465
469
await setTimeout ( 1000 ) ;
466
470
// refresh cache
467
471
await getPr ( number , true ) ;
468
- }
472
+ } /* v8 ignore stop */
469
473
470
474
async function getStatus (
471
475
branchName : string ,
@@ -609,7 +613,7 @@ export async function setBranchStatus({
609
613
610
614
// Issue
611
615
612
- /* istanbul ignore next */
616
+ /* v8 ignore start */
613
617
export function findIssue ( title : string ) : Promise < Issue | null > {
614
618
logger . debug ( `findIssue(${ title } )` ) ;
615
619
// This is used by Renovate when creating its own issues,
@@ -618,9 +622,9 @@ export function findIssue(title: string): Promise<Issue | null> {
618
622
//
619
623
// Bitbucket Server does not have issues
620
624
return Promise . resolve ( null ) ;
621
- }
625
+ } /* v8 ignore stop */
622
626
623
- /* istanbul ignore next */
627
+ /* v8 ignore start */
624
628
export function ensureIssue ( {
625
629
title,
626
630
} : EnsureIssueConfig ) : Promise < EnsureIssueResult | null > {
@@ -631,9 +635,9 @@ export function ensureIssue({
631
635
//
632
636
// Bitbucket Server does not have issues
633
637
return Promise . resolve ( null ) ;
634
- }
638
+ } /* v8 ignore stop */
635
639
636
- /* istanbul ignore next */
640
+ /* v8 ignore start */
637
641
export function getIssueList ( ) : Promise < Issue [ ] > {
638
642
logger . debug ( `getIssueList()` ) ;
639
643
// This is used by Renovate when creating its own issues,
@@ -642,9 +646,9 @@ export function getIssueList(): Promise<Issue[]> {
642
646
//
643
647
// Bitbucket Server does not have issues
644
648
return Promise . resolve ( [ ] ) ;
645
- }
649
+ } /* v8 ignore stop */
646
650
647
- /* istanbul ignore next */
651
+ /* v8 ignore start */
648
652
export function ensureIssueClosing ( title : string ) : Promise < void > {
649
653
logger . debug ( `ensureIssueClosing(${ title } )` ) ;
650
654
// This is used by Renovate when creating its own issues,
@@ -653,7 +657,7 @@ export function ensureIssueClosing(title: string): Promise<void> {
653
657
//
654
658
// Bitbucket Server does not have issues
655
659
return Promise . resolve ( ) ;
656
- }
660
+ } /* v8 ignore stop */
657
661
658
662
export function addAssignees ( iid : number , assignees : string [ ] ) : Promise < void > {
659
663
logger . debug ( `addAssignees(${ iid } , [${ assignees . join ( ', ' ) } ])` ) ;
@@ -874,10 +878,10 @@ export async function ensureComment({
874
878
logger . debug ( 'Comment is already update-to-date' ) ;
875
879
}
876
880
return true ;
877
- } catch ( err ) /* istanbul ignore next */ {
881
+ } catch ( err ) /* v8 ignore start */ {
878
882
logger . warn ( { err } , 'Error ensuring comment' ) ;
879
883
return false ;
880
- }
884
+ } /* v8 ignore stop */
881
885
}
882
886
883
887
export async function ensureCommentRemoval (
@@ -906,9 +910,9 @@ export async function ensureCommentRemoval(
906
910
if ( commentId ) {
907
911
await deleteComment ( prNo , commentId ) ;
908
912
}
909
- } catch ( err ) /* istanbul ignore next */ {
913
+ } catch ( err ) /* v8 ignore start */ {
910
914
logger . warn ( { err } , 'Error ensuring comment removal' ) ;
911
- }
915
+ } /* v8 ignore stop */
912
916
}
913
917
914
918
// Pull Request
@@ -968,7 +972,7 @@ export async function createPr({
968
972
`./rest/api/1.0/projects/${ config . projectKey } /repos/${ config . repositorySlug } /pull-requests` ,
969
973
{ body } ,
970
974
) ;
971
- } catch ( err ) /* istanbul ignore next */ {
975
+ } catch ( err ) /* v8 ignore start */ {
972
976
if (
973
977
err . body ?. errors ?. [ 0 ] ?. exceptionName ===
974
978
'com.atlassian.bitbucket.pull.EmptyPullRequestException'
@@ -980,7 +984,7 @@ export async function createPr({
980
984
throw new Error ( REPOSITORY_CHANGED ) ;
981
985
}
982
986
throw err ;
983
- }
987
+ } /* v8 ignore stop */
984
988
985
989
const pr : BbsPr = {
986
990
...utils . prInfo ( prInfoRes . body ) ,
@@ -989,10 +993,10 @@ export async function createPr({
989
993
// TODO #22198
990
994
updatePrVersion ( pr . number , pr . version ! ) ;
991
995
992
- // istanbul ignore if
996
+ /* v8 ignore start */
993
997
if ( config . prList ) {
994
998
config . prList . push ( pr ) ;
995
- }
999
+ } /* v8 ignore stop */
996
1000
997
1001
return pr ;
998
1002
}
@@ -1073,14 +1077,14 @@ export async function updatePr({
1073
1077
const existingIndex = config . prList . findIndex (
1074
1078
( item ) => item . number === prNo ,
1075
1079
) ;
1076
- // istanbul ignore if : should never happen
1080
+ /* v8 ignore start : should never happen */
1077
1081
if ( existingIndex === - 1 ) {
1078
1082
logger . warn (
1079
1083
{ pr : bbsPr } ,
1080
1084
'Possible error: Updated PR was not found in the PRs that were returned from getPrList().' ,
1081
1085
) ;
1082
1086
config . prList . push ( { ...bbsPr , state : finalState } ) ;
1083
- } else {
1087
+ } /* v8 ignore stop */ else {
1084
1088
config . prList [ existingIndex ] = { ...bbsPr , state : finalState } ;
1085
1089
}
1086
1090
}
0 commit comments