@@ -11,7 +11,7 @@ import { parseArgs } from "../util/parseArgs.js";
1111import { printHelp } from "../util/printHelp.js" ;
1212
1313suite ( "CLI" , ( ) => {
14- test ( "formats a file in place" , async ( ) => {
14+ test ( "Formats a file in place" , async ( ) => {
1515 const fileName = await createTempFile (
1616 "talonfmt-" ,
1717 "example.txt" ,
@@ -30,7 +30,7 @@ suite("CLI", () => {
3030 }
3131 } ) ;
3232
33- test ( "reports changes without writing in check mode" , async ( ) => {
33+ test ( "Reports changes without writing in check mode" , async ( ) => {
3434 const fileName = await createTempFile (
3535 "talonfmt-" ,
3636 "example.txt" ,
@@ -49,7 +49,7 @@ suite("CLI", () => {
4949 }
5050 } ) ;
5151
52- test ( "counts only changed files" , async ( ) => {
52+ test ( "Counts only changed files" , async ( ) => {
5353 const directory = await fs . mkdtemp ( path . join ( os . tmpdir ( ) , "talonfmt-" ) ) ;
5454 const unchangedFileName = path . join ( directory , "unchanged.txt" ) ;
5555 const changedFileName = path . join ( directory , "changed.txt" ) ;
@@ -81,7 +81,7 @@ suite("CLI", () => {
8181 }
8282 } ) ;
8383
84- test ( "ignores missing files" , async ( ) => {
84+ test ( "Ignores missing files" , async ( ) => {
8585 const fileName = path . join ( os . tmpdir ( ) , "talonfmt-missing.txt" ) ;
8686 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
8787
@@ -90,7 +90,7 @@ suite("CLI", () => {
9090 assert . equal ( didChange , false ) ;
9191 } ) ;
9292
93- test ( "wraps formatter errors" , async ( ) => {
93+ test ( "Wraps formatter errors" , async ( ) => {
9494 const fileName = await createTempFile (
9595 "talonfmt-" ,
9696 "example.txt" ,
@@ -110,7 +110,7 @@ suite("CLI", () => {
110110 }
111111 } ) ;
112112
113- test ( "writes formatted stdin to stdout" , async ( ) => {
113+ test ( "Writes formatted stdin to stdout" , async ( ) => {
114114 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
115115 const output = await captureStreamWrite ( process . stdout , async ( ) =>
116116 readAndFormatStdin ( cli , "content" ) ,
@@ -120,7 +120,7 @@ suite("CLI", () => {
120120 assert . equal ( output . text , "content updated" ) ;
121121 } ) ;
122122
123- test ( "reports stdin formatting issues to stderr in check mode" , async ( ) => {
123+ test ( "Reports stdin formatting issues to stderr in check mode" , async ( ) => {
124124 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
125125 const output = await captureStreamWrite ( process . stderr , async ( ) =>
126126 readAndFormatStdin ( cli , "content" , true ) ,
@@ -130,7 +130,7 @@ suite("CLI", () => {
130130 assert . equal ( output . text , "[warn] Code style issues found in stdin." ) ;
131131 } ) ;
132132
133- test ( "returns success for unchanged stdin in check mode" , async ( ) => {
133+ test ( "Returns success for unchanged stdin in check mode" , async ( ) => {
134134 const cli = createCLI ( ( text ) => text ) ;
135135 const stderr = await captureStreamWrite ( process . stderr , async ( ) =>
136136 readAndFormatStdin ( cli , "content" , true ) ,
@@ -145,7 +145,7 @@ suite("CLI", () => {
145145 assert . equal ( stdout . text , "" ) ;
146146 } ) ;
147147
148- test ( "passes options and file name to file formatter" , async ( ) => {
148+ test ( "Passes options and file name to file formatter" , async ( ) => {
149149 const fileName = await createTempFile (
150150 "talonfmt-" ,
151151 "example.txt" ,
@@ -183,7 +183,7 @@ suite("CLI", () => {
183183 }
184184 } ) ;
185185
186- test ( "passes options and stdin file name to stdin formatter" , async ( ) => {
186+ test ( "Passes options and stdin file name to stdin formatter" , async ( ) => {
187187 const options = {
188188 indentTabs : true ,
189189 indentWidth : 2 ,
@@ -212,7 +212,7 @@ suite("CLI", () => {
212212 assert . equal ( actualFileName , "stdin" ) ;
213213 } ) ;
214214
215- test ( "parses check mode" , ( ) => {
215+ test ( "Parses check mode" , ( ) => {
216216 const expected = getArguments ( {
217217 filePatterns : [ "a.txt" , "b.txt" ] ,
218218 check : true ,
@@ -225,7 +225,7 @@ suite("CLI", () => {
225225 assert . deepEqual ( actual , expected ) ;
226226 } ) ;
227227
228- test ( "parses check mode and end-of-options marker" , ( ) => {
228+ test ( "Parses check mode and end-of-options marker" , ( ) => {
229229 const expected = getArguments ( {
230230 filePatterns : [ "--check" ] ,
231231 check : true ,
@@ -238,15 +238,15 @@ suite("CLI", () => {
238238 assert . deepEqual ( actual , expected ) ;
239239 } ) ;
240240
241- test ( "parses tabs and width arguments" , ( ) => {
241+ test ( "Parses tabs and width arguments" , ( ) => {
242242 const expected = getArguments ( {
243243 filePatterns : [ "a.txt" ] ,
244244 help : false ,
245245 version : false ,
246246 check : false ,
247247 indentTabs : true ,
248248 indentWidth : 2 ,
249- lineWidth : undefined ,
249+ lineWidth : 40 ,
250250 columnWidth : 24 ,
251251 } ) ;
252252 const actual = parseArgs (
@@ -255,6 +255,8 @@ suite("CLI", () => {
255255 "--indent-tabs" ,
256256 "--indent-width" ,
257257 "2" ,
258+ "--line-width" ,
259+ "40" ,
258260 "--column-width" ,
259261 "24" ,
260262 "a.txt" ,
@@ -264,7 +266,7 @@ suite("CLI", () => {
264266 assert . deepEqual ( actual , expected ) ;
265267 } ) ;
266268
267- test ( "rejects unsupported formatter arguments" , ( ) => {
269+ test ( "Rejects unsupported formatter arguments" , ( ) => {
268270 const snippetCli : CLI = {
269271 ...createCLI ( ( ) => "" ) ,
270272 binName : "snippet-fmt" ,
@@ -278,7 +280,7 @@ suite("CLI", () => {
278280 ) ;
279281 } ) ;
280282
281- test ( "rejects unsupported formatter flags" , ( ) => {
283+ test ( "Rejects unsupported formatter flags" , ( ) => {
282284 const snippetCli : CLI = {
283285 ...createCLI ( ( ) => "" ) ,
284286 binName : "snippet-fmt" ,
@@ -291,7 +293,7 @@ suite("CLI", () => {
291293 ) ;
292294 } ) ;
293295
294- test ( "parses only supported arguments for current cli" , ( ) => {
296+ test ( "Parses only supported arguments for current cli" , ( ) => {
295297 const expected = getArguments ( {
296298 filePatterns : [ "a.txt" ] ,
297299 indentTabs : true ,
@@ -313,7 +315,7 @@ suite("CLI", () => {
313315 assert . deepEqual ( actual , expected ) ;
314316 } ) ;
315317
316- test ( "prints help only for supported arguments" , async ( ) => {
318+ test ( "Prints help only for supported arguments" , async ( ) => {
317319 const cli : CLI = {
318320 binName : "tree-sitter-fmt" ,
319321 fileEndings : [ "scm" ] ,
@@ -345,7 +347,7 @@ suite("CLI", () => {
345347 ) ;
346348 } ) ;
347349
348- test ( "rejects unknown arguments" , ( ) => {
350+ test ( "Rejects unknown arguments" , ( ) => {
349351 assert . throws (
350352 ( ) =>
351353 parseArgs (
@@ -356,7 +358,7 @@ suite("CLI", () => {
356358 ) ;
357359 } ) ;
358360
359- test ( "rejects missing width values" , ( ) => {
361+ test ( "Rejects missing width values" , ( ) => {
360362 assert . throws (
361363 ( ) =>
362364 parseArgs (
@@ -367,7 +369,7 @@ suite("CLI", () => {
367369 ) ;
368370 } ) ;
369371
370- test ( "rejects invalid width values" , ( ) => {
372+ test ( "Rejects invalid width values" , ( ) => {
371373 assert . throws (
372374 ( ) =>
373375 parseArgs (
@@ -399,7 +401,11 @@ function createCLI(format: (text: string) => string | Promise<string>): CLI {
399401 binName : "talon-fmt" as const ,
400402 fileEndings : [ "txt" ] ,
401403 supportedFlagArgs : [ "--indent-tabs" ] ,
402- supportedValueArgs : [ "--indent-width" , "--column-width" ] ,
404+ supportedValueArgs : [
405+ "--indent-width" ,
406+ "--line-width" ,
407+ "--column-width" ,
408+ ] ,
403409 format : ( text : string ) => Promise . resolve ( format ( text ) ) ,
404410 } ;
405411}
0 commit comments