@@ -6,10 +6,7 @@ import { PassThrough } from "node:stream";
66import { formatFile , formatFiles , mainFormatStdin } from "../cli/cli.js" ;
77import type { CLI , Options , ParsedArgs } from "../types.js" ;
88import { EXIT_FAIL , EXIT_OK } from "../util/constants.js" ;
9- import {
10- getDefaultArguments ,
11- getDefaultOptions ,
12- } from "../util/getDefaultArguments.js" ;
9+ import { getDefaultArguments } from "../util/getDefaultArguments.js" ;
1310import { parseArgs } from "../util/parseArgs.js" ;
1411import { printHelp } from "../util/printHelp.js" ;
1512
@@ -23,12 +20,7 @@ suite("CLI", () => {
2320 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
2421
2522 try {
26- const didChange = await formatFile (
27- cli ,
28- false ,
29- getDefaultOptions ( ) ,
30- fileName ,
31- ) ;
23+ const didChange = await formatFile ( cli , false , { } , fileName ) ;
3224 const actual = await fs . readFile ( fileName , "utf8" ) ;
3325
3426 assert . equal ( didChange , true ) ;
@@ -47,12 +39,7 @@ suite("CLI", () => {
4739 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
4840
4941 try {
50- const didChange = await formatFile (
51- cli ,
52- true ,
53- getDefaultOptions ( ) ,
54- fileName ,
55- ) ;
42+ const didChange = await formatFile ( cli , true , { } , fileName ) ;
5643 const actual = await fs . readFile ( fileName , "utf8" ) ;
5744
5845 assert . equal ( didChange , true ) ;
@@ -78,7 +65,7 @@ suite("CLI", () => {
7865 cli ,
7966 [ unchangedFileName , changedFileName ] ,
8067 false ,
81- getDefaultOptions ( ) ,
68+ { } ,
8269 ) ;
8370 const unchangedContent = await fs . readFile (
8471 unchangedFileName ,
@@ -98,12 +85,7 @@ suite("CLI", () => {
9885 const fileName = path . join ( os . tmpdir ( ) , "talonfmt-missing.txt" ) ;
9986 const cli = createCLI ( ( text ) => `${ text } updated` ) ;
10087
101- const didChange = await formatFile (
102- cli ,
103- false ,
104- getDefaultOptions ( ) ,
105- fileName ,
106- ) ;
88+ const didChange = await formatFile ( cli , false , { } , fileName ) ;
10789
10890 assert . equal ( didChange , false ) ;
10991 } ) ;
@@ -120,7 +102,7 @@ suite("CLI", () => {
120102
121103 try {
122104 await assert . rejects (
123- formatFile ( cli , false , getDefaultOptions ( ) , fileName ) ,
105+ formatFile ( cli , false , { } , fileName ) ,
124106 / F a i l e d t o f o r m a t ' .* e x a m p l e \. t x t ' : b o o m / ,
125107 ) ;
126108 } finally {
@@ -170,7 +152,6 @@ suite("CLI", () => {
170152 "content" ,
171153 ) ;
172154 const options = {
173- ...getDefaultOptions ( ) ,
174155 indentTabs : true ,
175156 indentWidth : 2 ,
176157 columnWidth : 24 ,
@@ -204,7 +185,6 @@ suite("CLI", () => {
204185
205186 test ( "passes options and stdin file name to stdin formatter" , async ( ) => {
206187 const options = {
207- ...getDefaultOptions ( ) ,
208188 indentTabs : true ,
209189 indentWidth : 2 ,
210190 } ;
@@ -266,7 +246,7 @@ suite("CLI", () => {
266246 check : false ,
267247 indentTabs : true ,
268248 indentWidth : 2 ,
269- lineWidth : 80 ,
249+ lineWidth : undefined ,
270250 columnWidth : 24 ,
271251 } ) ;
272252 const actual = parseArgs (
@@ -428,7 +408,7 @@ async function readAndFormatStdin(
428408 cli : CLI ,
429409 input : string ,
430410 check : boolean = false ,
431- options : Options = getDefaultOptions ( ) ,
411+ options : Options = { } ,
432412) : Promise < number > {
433413 const stdin = new PassThrough ( ) ;
434414 Object . defineProperty ( stdin , "isTTY" , { value : false } ) ;
0 commit comments