@@ -32,7 +32,6 @@ test.each([
3232 [ '--write' , 'write' ] ,
3333 [ '--check' , 'check' ] ,
3434 [ '--list-different' , 'list-different' ] ,
35- [ '--listDifferent' , 'list-different' ] ,
3635] as const ) ( 'parses %s mode' , ( option , mode ) => {
3736 expect ( parseFmtCLIArgs ( [ option ] ) ) . toEqual ( {
3837 mode,
@@ -44,19 +43,16 @@ test.each([
4443 } ) ;
4544} ) ;
4645
47- test . each ( [ '--parallel-workers' , '--parallelWorkers' ] ) (
48- 'configures parallel worker count with %s' ,
49- ( option ) => {
50- expect ( parseFmtCLIArgs ( [ option , '3' ] ) ) . toEqual ( {
51- mode : 'write' ,
52- patterns : [ ] ,
53- ignorePaths : [ ] ,
54- noErrorOnUnmatchedPattern : false ,
55- maxWorkers : 3 ,
56- help : false ,
57- } ) ;
58- } ,
59- ) ;
46+ test ( 'configures parallel worker count' , ( ) => {
47+ expect ( parseFmtCLIArgs ( [ '--parallel-workers' , '3' ] ) ) . toEqual ( {
48+ mode : 'write' ,
49+ patterns : [ ] ,
50+ ignorePaths : [ ] ,
51+ noErrorOnUnmatchedPattern : false ,
52+ maxWorkers : 3 ,
53+ help : false ,
54+ } ) ;
55+ } ) ;
6056
6157test . each ( [ '0' , '-1' , '1.5' , 'invalid' , '9007199254740992' ] ) (
6258 'rejects invalid parallel worker count %s' ,
@@ -67,10 +63,6 @@ test.each(['0', '-1', '1.5', 'invalid', '9007199254740992'])(
6763 } ,
6864) ;
6965
70- test ( 'prefers the kebab-case parallel worker option' , ( ) => {
71- expect ( parseFmtCLIArgs ( [ '--parallel-workers' , '2' , '--parallelWorkers' , '3' ] ) . maxWorkers ) . toBe ( 2 ) ;
72- } ) ;
73-
7466test ( 'preserves file paths and globs' , ( ) => {
7567 const patterns = [ 'src/file with spaces.ts' , 'src/**/*.{js,ts}' , '!src/generated/**' ] ;
7668
@@ -99,28 +91,19 @@ test.each(['--help', '-h'])('parses %s', (option) => {
9991 expect ( parseFmtCLIArgs ( [ option ] ) . help ) . toBe ( true ) ;
10092} ) ;
10193
102- test . each ( [ '--ignore-path' , '--ignorePath' ] ) ( 'collects repeated ignore paths with %s' , ( option ) => {
103- expect (
104- parseFmtCLIArgs ( [ option , '.prettierignore' , `${ option } =config/format.ignore` ] ) . ignorePaths ,
105- ) . toEqual ( [ '.prettierignore' , 'config/format.ignore' ] ) ;
106- } ) ;
107-
108- test ( 'combines kebab-case and camel-case ignore paths' , ( ) => {
94+ test ( 'collects repeated ignore paths' , ( ) => {
10995 expect (
110- parseFmtCLIArgs ( [ '--ignore-path' , '.prettierignore' , '--ignorePath' , ' config/format.ignore'] )
96+ parseFmtCLIArgs ( [ '--ignore-path' , '.prettierignore' , '--ignore-path= config/format.ignore' ] )
11197 . ignorePaths ,
11298 ) . toEqual ( [ '.prettierignore' , 'config/format.ignore' ] ) ;
11399} ) ;
114100
115- test . each ( [ '--no-error-on-unmatched-pattern' , '--noErrorOnUnmatchedPattern' ] ) (
116- 'parses %s' ,
117- ( option ) => {
118- expect ( parseFmtCLIArgs ( [ option ] ) . noErrorOnUnmatchedPattern ) . toBe ( true ) ;
119- } ,
120- ) ;
101+ test ( 'parses --no-error-on-unmatched-pattern' , ( ) => {
102+ expect ( parseFmtCLIArgs ( [ '--no-error-on-unmatched-pattern' ] ) . noErrorOnUnmatchedPattern ) . toBe ( true ) ;
103+ } ) ;
121104
122- test . each ( [ ' --stdin-filepath', '--stdinFilepath' ] ) ( 'parses %s' , ( option ) => {
123- expect ( parseFmtCLIArgs ( [ option , 'src/index.ts' ] ) ) . toEqual ( {
105+ test ( 'parses --stdin-filepath', ( ) => {
106+ expect ( parseFmtCLIArgs ( [ '--stdin-filepath' , 'src/index.ts' ] ) ) . toEqual ( {
124107 mode : 'write' ,
125108 patterns : [ ] ,
126109 ignorePaths : [ ] ,
@@ -143,7 +126,7 @@ test('accepts a worker count with --stdin-filepath', () => {
143126 } ) ;
144127} ) ;
145128
146- test . each ( [ '--write' , '--check' , '--list-different' , '--listDifferent' ] ) (
129+ test . each ( [ '--write' , '--check' , '--list-different' ] ) (
147130 'rejects %s with --stdin-filepath' ,
148131 ( option ) => {
149132 expect ( ( ) => parseFmtCLIArgs ( [ '--stdin-filepath' , 'index.ts' , option ] ) ) . toThrow (
@@ -168,7 +151,6 @@ test('provides command help', () => {
168151test . each ( [
169152 [ '--write' , '--check' ] ,
170153 [ '--write' , '--list-different' ] ,
171- [ '--write' , '--listDifferent' ] ,
172154 [ '--check' , '--list-different' ] ,
173155 [ '--write' , '--check' , '--list-different' ] ,
174156] ) ( 'rejects conflicting modes: %s' , ( ...args ) => {
@@ -177,7 +159,7 @@ test.each([
177159 ) ;
178160} ) ;
179161
180- test . each ( [ '--unknown' , '--no-cache' , '--no-parallel' , '--noParallel' ] ) (
162+ test . each ( [ '--unknown' , '--no-cache' , '--no-parallel' ] ) (
181163 'rejects unsupported option %s' ,
182164 ( option ) => {
183165 expect ( ( ) => parseFmtCLIArgs ( [ option ] ) ) . toThrow ( ) ;
0 commit comments