File tree 4 files changed +27
-2
lines changed
4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1
1
const id = 'fixes-url'
2
2
const github = new RegExp ( '^https://github\\.com/[\\w-]+/[\\w-]+/' +
3
- '(issues|pull)/\\d+(#issuecomment-\\d+|#discussion_r\\d+)?$'
3
+ '(issues|pull)/\\d+(#issuecomment-\\d+|#discussion_r\\d+)?/? $'
4
4
)
5
5
6
6
export default {
Original file line number Diff line number Diff line change 1
1
const id = 'pr-url'
2
- const prUrl = / ^ h t t p s : \/ \/ g i t h u b \. c o m \/ [ \w - ] + \/ [ \w - ] + \/ p u l l \/ \d + $ /
2
+ const prUrl = / ^ h t t p s : \/ \/ g i t h u b \. c o m \/ [ \w - ] + \/ [ \w - ] + \/ p u l l \/ \d + \/ ? $ /
3
3
4
4
export default {
5
5
id,
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ test('rule: fixes-url', (t) => {
24
24
const valid = [
25
25
[ 'GitHub issue URL' ,
26
26
'https://github.com/nodejs/node/issues/1234' ] ,
27
+ [ 'GitHub issue URL with trailing slash' ,
28
+ 'https://github.com/nodejs/node/issues/1234/' ] ,
27
29
[ 'GitHub issue URL containing hyphen' ,
28
30
'https://github.com/nodejs/node-report/issues/1234' ] ,
29
31
[ 'GitHub issue URL containing hyphen with comment' ,
Original file line number Diff line number Diff line change @@ -115,5 +115,28 @@ test('rule: pr-url', (t) => {
115
115
Rule . validate ( context )
116
116
} )
117
117
118
+ t . test ( 'valid URL with trailing slash' , ( tt ) => {
119
+ tt . plan ( 7 )
120
+ const url = 'https://github.com/nodejs/node-report/pull/1234/'
121
+ const context = {
122
+ prUrl : url ,
123
+ body : [
124
+ '' ,
125
+ `PR-URL: ${ url } `
126
+ ] ,
127
+ report : ( opts ) => {
128
+ tt . pass ( 'called report' )
129
+ tt . equal ( opts . id , 'pr-url' , 'id' )
130
+ tt . equal ( opts . message , VALID_PR_URL , 'message' )
131
+ tt . equal ( opts . string , url , 'string' )
132
+ tt . equal ( opts . line , 1 , 'line' )
133
+ tt . equal ( opts . column , 8 , 'column' )
134
+ tt . equal ( opts . level , 'pass' , 'level' )
135
+ }
136
+ }
137
+
138
+ Rule . validate ( context )
139
+ } )
140
+
118
141
t . end ( )
119
142
} )
You can’t perform that action at this time.
0 commit comments