@@ -39,6 +39,18 @@ describe('util', () => {
3939 'loom' ,
4040 ] ) ;
4141 } ) ;
42+ it ( 'handles globs with brace groups containing commas' , ( ) => {
43+ assert . deepStrictEqual ( parseInputFiles ( './**/*.{exe,deb,tar.gz}\nfoo,bar' ) , [
44+ './**/*.{exe,deb,tar.gz}' ,
45+ 'foo' ,
46+ 'bar' ,
47+ ] ) ;
48+ } ) ;
49+ it ( 'handles single-line brace pattern correctly' , ( ) => {
50+ assert . deepStrictEqual ( parseInputFiles ( './**/*.{exe,deb,tar.gz}' ) , [
51+ './**/*.{exe,deb,tar.gz}' ,
52+ ] ) ;
53+ } ) ;
4254 } ) ;
4355 describe ( 'releaseBody' , ( ) => {
4456 it ( 'uses input body' , ( ) => {
@@ -113,6 +125,52 @@ describe('util', () => {
113125 } ) ,
114126 ) ;
115127 } ) ;
128+ it ( 'falls back to body when body_path is missing' , ( ) => {
129+ assert . equal (
130+ releaseBody ( {
131+ github_ref : '' ,
132+ github_repository : '' ,
133+ github_token : '' ,
134+ input_body : 'fallback-body' ,
135+ input_body_path : '__tests__/does-not-exist.txt' ,
136+ input_draft : false ,
137+ input_prerelease : false ,
138+ input_files : [ ] ,
139+ input_overwrite_files : undefined ,
140+ input_preserve_order : undefined ,
141+ input_name : undefined ,
142+ input_tag_name : undefined ,
143+ input_target_commitish : undefined ,
144+ input_discussion_category_name : undefined ,
145+ input_generate_release_notes : false ,
146+ input_make_latest : undefined ,
147+ } ) ,
148+ 'fallback-body' ,
149+ ) ;
150+ } ) ;
151+ it ( 'returns undefined when body_path is missing and body is not provided' , ( ) => {
152+ assert . equal (
153+ releaseBody ( {
154+ github_ref : '' ,
155+ github_repository : '' ,
156+ github_token : '' ,
157+ input_body : undefined ,
158+ input_body_path : '__tests__/does-not-exist.txt' ,
159+ input_draft : false ,
160+ input_prerelease : false ,
161+ input_files : [ ] ,
162+ input_overwrite_files : undefined ,
163+ input_preserve_order : undefined ,
164+ input_name : undefined ,
165+ input_tag_name : undefined ,
166+ input_target_commitish : undefined ,
167+ input_discussion_category_name : undefined ,
168+ input_generate_release_notes : false ,
169+ input_make_latest : undefined ,
170+ } ) ,
171+ undefined ,
172+ ) ;
173+ } ) ;
116174 } ) ;
117175 describe ( 'parseConfig' , ( ) => {
118176 it ( 'parses basic config' , ( ) => {
@@ -131,6 +189,7 @@ describe('util', () => {
131189 github_ref : '' ,
132190 github_repository : '' ,
133191 github_token : '' ,
192+ input_working_directory : undefined ,
134193 input_append_body : false ,
135194 input_body : undefined ,
136195 input_body_path : undefined ,
@@ -160,6 +219,7 @@ describe('util', () => {
160219 github_ref : '' ,
161220 github_repository : '' ,
162221 github_token : '' ,
222+ input_working_directory : undefined ,
163223 input_append_body : false ,
164224 input_body : undefined ,
165225 input_body_path : undefined ,
@@ -188,6 +248,7 @@ describe('util', () => {
188248 github_ref : '' ,
189249 github_repository : '' ,
190250 github_token : '' ,
251+ input_working_directory : undefined ,
191252 input_append_body : false ,
192253 input_body : undefined ,
193254 input_body_path : undefined ,
@@ -217,6 +278,7 @@ describe('util', () => {
217278 github_ref : '' ,
218279 github_repository : '' ,
219280 github_token : '' ,
281+ input_working_directory : undefined ,
220282 input_append_body : false ,
221283 input_body : undefined ,
222284 input_body_path : undefined ,
@@ -250,6 +312,7 @@ describe('util', () => {
250312 github_ref : '' ,
251313 github_repository : '' ,
252314 github_token : 'env-token' ,
315+ input_working_directory : undefined ,
253316 input_append_body : false ,
254317 input_body : undefined ,
255318 input_body_path : undefined ,
@@ -280,6 +343,7 @@ describe('util', () => {
280343 github_ref : '' ,
281344 github_repository : '' ,
282345 github_token : 'input-token' ,
346+ input_working_directory : undefined ,
283347 input_append_body : false ,
284348 input_body : undefined ,
285349 input_body_path : undefined ,
@@ -309,6 +373,7 @@ describe('util', () => {
309373 github_ref : '' ,
310374 github_repository : '' ,
311375 github_token : '' ,
376+ input_working_directory : undefined ,
312377 input_append_body : false ,
313378 input_body : undefined ,
314379 input_body_path : undefined ,
@@ -337,6 +402,7 @@ describe('util', () => {
337402 github_ref : '' ,
338403 github_repository : '' ,
339404 github_token : '' ,
405+ input_working_directory : undefined ,
340406 input_append_body : false ,
341407 input_body : undefined ,
342408 input_body_path : undefined ,
@@ -365,6 +431,7 @@ describe('util', () => {
365431 github_ref : '' ,
366432 github_repository : '' ,
367433 github_token : '' ,
434+ input_working_directory : undefined ,
368435 input_append_body : true ,
369436 input_body : undefined ,
370437 input_body_path : undefined ,
@@ -400,6 +467,10 @@ describe('util', () => {
400467 'tests/data/foo/bar.txt' ,
401468 ] ) ;
402469 } ) ;
470+
471+ it ( 'resolves files relative to working_directory' , async ( ) => {
472+ assert . deepStrictEqual ( paths ( [ 'data/**/*' ] , 'tests' ) , [ 'tests/data/foo/bar.txt' ] ) ;
473+ } ) ;
403474 } ) ;
404475
405476 describe ( 'unmatchedPatterns' , ( ) => {
@@ -409,6 +480,12 @@ describe('util', () => {
409480 [ 'tests/data/does/not/exist/*' ] ,
410481 ) ;
411482 } ) ;
483+
484+ it ( 'resolves unmatched relative to working_directory' , async ( ) => {
485+ assert . deepStrictEqual ( unmatchedPatterns ( [ 'data/does/not/exist/*' ] , 'tests' ) , [
486+ 'data/does/not/exist/*' ,
487+ ] ) ;
488+ } ) ;
412489 } ) ;
413490
414491 describe ( 'replaceSpacesWithDots' , ( ) => {
@@ -425,3 +502,36 @@ describe('util', () => {
425502 } ) ;
426503 } ) ;
427504} ) ;
505+
506+ describe ( 'parseInputFiles edge cases' , ( ) => {
507+ it ( 'handles multiple brace groups on same line' , ( ) => {
508+ assert . deepStrictEqual ( parseInputFiles ( './**/*.{exe,deb},./dist/**/*.{zip,tar.gz}' ) , [
509+ './**/*.{exe,deb}' ,
510+ './dist/**/*.{zip,tar.gz}' ,
511+ ] ) ;
512+ } ) ;
513+
514+ it ( 'handles nested braces' , ( ) => {
515+ assert . deepStrictEqual ( parseInputFiles ( 'path/{a,{b,c}}/file.txt' ) , [ 'path/{a,{b,c}}/file.txt' ] ) ;
516+ } ) ;
517+
518+ it ( 'handles empty comma-separated values' , ( ) => {
519+ assert . deepStrictEqual ( parseInputFiles ( 'foo,,bar' ) , [ 'foo' , 'bar' ] ) ;
520+ } ) ;
521+
522+ it ( 'handles commas with spaces around braces' , ( ) => {
523+ assert . deepStrictEqual ( parseInputFiles ( ' ./**/*.{exe,deb} , file.txt ' ) , [
524+ './**/*.{exe,deb}' ,
525+ 'file.txt' ,
526+ ] ) ;
527+ } ) ;
528+
529+ it ( 'handles mixed newlines and commas with braces' , ( ) => {
530+ assert . deepStrictEqual ( parseInputFiles ( 'file1.txt\n./**/*.{exe,deb},file2.txt\nfile3.txt' ) , [
531+ 'file1.txt' ,
532+ './**/*.{exe,deb}' ,
533+ 'file2.txt' ,
534+ 'file3.txt' ,
535+ ] ) ;
536+ } ) ;
537+ } ) ;
0 commit comments