@@ -15,10 +15,16 @@ import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
1515const SINGLE_TEMPLATE_PATHS = [
1616 ".github/pull_request_template.md" ,
1717 ".github/PULL_REQUEST_TEMPLATE.md" ,
18+ ".github/pull_request_template.txt" ,
19+ ".github/PULL_REQUEST_TEMPLATE.txt" ,
1820 "pull_request_template.md" ,
1921 "PULL_REQUEST_TEMPLATE.md" ,
22+ "pull_request_template.txt" ,
23+ "PULL_REQUEST_TEMPLATE.txt" ,
2024 "docs/pull_request_template.md" ,
2125 "docs/PULL_REQUEST_TEMPLATE.md" ,
26+ "docs/pull_request_template.txt" ,
27+ "docs/PULL_REQUEST_TEMPLATE.txt" ,
2228] as const ;
2329
2430const TEMPLATE_DIRECTORIES = [
@@ -128,10 +134,14 @@ it.effect("uses the first non-empty template in the configured path order", () =
128134 ) ,
129135) ;
130136
131- it . effect . each ( TEMPLATE_DIRECTORIES ) ( "recognizes the $0 directory" , ( relativeDirectory ) =>
137+ it . effect . each (
138+ TEMPLATE_DIRECTORIES . flatMap ( ( directory ) =>
139+ [ "MD" , "TXT" ] . map ( ( extension ) => `${ directory } /template.${ extension } ` ) ,
140+ ) ,
141+ ) ( "recognizes directory template $0" , ( relativePath ) =>
132142 runWithTempDirectory ( ( cwd ) =>
133143 Effect . gen ( function * ( ) {
134- yield * writeTemplate ( cwd , ` ${ relativeDirectory } /template.MD` , "directory template" ) ;
144+ yield * writeTemplate ( cwd , relativePath , "directory template" ) ;
135145 yield * commitTemplates ( cwd ) ;
136146
137147 const template = yield * detectTemplate ( cwd ) ;
@@ -165,6 +175,19 @@ it.effect.skipIf(!symlinksSupported)(
165175 ) ,
166176) ;
167177
178+ it . effect ( "does not guess between Markdown and text directory templates" , ( ) =>
179+ runWithTempDirectory ( ( cwd ) =>
180+ Effect . gen ( function * ( ) {
181+ yield * writeTemplate ( cwd , ".github/PULL_REQUEST_TEMPLATE/a.md" , "first" ) ;
182+ yield * writeTemplate ( cwd , ".github/PULL_REQUEST_TEMPLATE/b.txt" , "second" ) ;
183+ yield * commitTemplates ( cwd ) ;
184+
185+ const template = yield * detectTemplate ( cwd ) ;
186+ assert . isTrue ( Option . isNone ( template ) ) ;
187+ } ) ,
188+ ) ,
189+ ) ;
190+
168191it . effect ( "does not guess between multiple directory templates" , ( ) =>
169192 runWithTempDirectory ( ( cwd ) =>
170193 Effect . gen ( function * ( ) {
0 commit comments