@@ -17,14 +17,20 @@ const SINGLE_TEMPLATE_PATHS = [
1717 ".github/PULL_REQUEST_TEMPLATE.md" ,
1818 ".github/pull_request_template.txt" ,
1919 ".github/PULL_REQUEST_TEMPLATE.txt" ,
20+ ".github/PULL_REQUEST_TEMPLATE.TXT" ,
21+ ".github/PuLl_ReQuEsT_TeMpLaTe.TxT" ,
2022 "pull_request_template.md" ,
2123 "PULL_REQUEST_TEMPLATE.md" ,
2224 "pull_request_template.txt" ,
2325 "PULL_REQUEST_TEMPLATE.txt" ,
26+ "PULL_REQUEST_TEMPLATE.TXT" ,
27+ "PuLl_ReQuEsT_TeMpLaTe.TxT" ,
2428 "docs/pull_request_template.md" ,
2529 "docs/PULL_REQUEST_TEMPLATE.md" ,
2630 "docs/pull_request_template.txt" ,
2731 "docs/PULL_REQUEST_TEMPLATE.txt" ,
32+ "docs/PULL_REQUEST_TEMPLATE.TXT" ,
33+ "docs/PuLl_ReQuEsT_TeMpLaTe.TxT" ,
2834] as const ;
2935
3036const TEMPLATE_DIRECTORIES = [
@@ -101,6 +107,49 @@ it.effect.each(SINGLE_TEMPLATE_PATHS)("recognizes $0", (relativePath) =>
101107 ) ,
102108) ;
103109
110+ it . effect . each ( [ ".github/PuLl_ReQuEsT_TeMpLaTe.MD" , "docs/PULL_REQUEST_TEMPLATE.Md" ] ) (
111+ "recognizes Markdown case variant $0" ,
112+ ( relativePath ) =>
113+ runWithTempDirectory ( ( cwd ) =>
114+ Effect . gen ( function * ( ) {
115+ yield * writeTemplate ( cwd , relativePath , "Markdown template" ) ;
116+ yield * commitTemplates ( cwd ) ;
117+
118+ assert . strictEqual ( Option . getOrUndefined ( yield * detectTemplate ( cwd ) ) , "Markdown template" ) ;
119+ } ) ,
120+ ) ,
121+ ) ;
122+
123+ it . effect ( "finds case variants from a repository subdirectory" , ( ) =>
124+ runWithTempDirectory ( ( cwd ) =>
125+ Effect . gen ( function * ( ) {
126+ const path = yield * Path . Path ;
127+ yield * writeTemplate ( cwd , ".github/Pull_Request_Template.TXT" , "base template" ) ;
128+ yield * writeTemplate ( cwd , "nested/README.md" , "project" ) ;
129+ yield * commitTemplates ( cwd ) ;
130+
131+ assert . strictEqual (
132+ Option . getOrUndefined ( yield * detectTemplate ( path . join ( cwd , "nested" ) ) ) ,
133+ "base template" ,
134+ ) ;
135+ } ) ,
136+ ) ,
137+ ) ;
138+
139+ it . effect ( "does not let unrelated nested documents exhaust the template listing" , ( ) =>
140+ runWithTempDirectory ( ( cwd ) =>
141+ Effect . gen ( function * ( ) {
142+ yield * writeTemplate ( cwd , "docs/Pull_Request_Template.TXT" , "docs template" ) ;
143+ for ( let index = 0 ; index < 600 ; index += 1 ) {
144+ yield * writeTemplate ( cwd , `docs/guides/${ index } -${ "a" . repeat ( 180 ) } .md` , "guide" ) ;
145+ }
146+ yield * commitTemplates ( cwd ) ;
147+
148+ assert . strictEqual ( Option . getOrUndefined ( yield * detectTemplate ( cwd ) ) , "docs template" ) ;
149+ } ) ,
150+ ) ,
151+ ) ;
152+
104153it . effect ( "reads templates from the requested base tree" , ( ) =>
105154 runWithTempDirectory ( ( cwd ) =>
106155 Effect . gen ( function * ( ) {
0 commit comments