@@ -48,6 +48,33 @@ test('runs lint followed by a formatting check', () => {
4848 expect ( formatted . stderr ) . toBe ( '' ) ;
4949} ) ;
5050
51+ test ( 'passes file arguments to lint and the formatting check' , ( ) => {
52+ writeLintConfig ( ) ;
53+ writeProjectFile ( 'src/selected-a.ts' , 'const selectedA = true;\n' ) ;
54+ writeProjectFile ( 'src/selected-b.ts' , 'const selectedB = true;\n' ) ;
55+ writeProjectFile ( 'src/unselected-lint-error.ts' , 'debugger;\n' ) ;
56+ writeProjectFile ( 'src/unselected-format-error.ts' , 'const value=true' ) ;
57+
58+ const result = runCheck ( [ 'src/selected-a.ts' , 'src/selected-b.ts' ] ) ;
59+
60+ expect ( result . status ) . toBe ( 0 ) ;
61+ expect ( result . stdout ) . toContain ( 'Format check passed in' ) ;
62+ expect ( result . stdout ) . toContain ( '(2 files)' ) ;
63+ expect ( result . stderr ) . toBe ( '' ) ;
64+ } ) ;
65+
66+ test ( 'supports file arguments after the option terminator' , ( ) => {
67+ writeLintConfig ( ) ;
68+ writeProjectFile ( '--selected.ts' , 'const selected = true;\n' ) ;
69+
70+ const result = runCheck ( [ '--' , '--selected.ts' ] ) ;
71+
72+ expect ( result . status ) . toBe ( 0 ) ;
73+ expect ( result . stdout ) . toContain ( 'Format check passed in' ) ;
74+ expect ( result . stdout ) . toContain ( '(1 file)' ) ;
75+ expect ( result . stderr ) . toBe ( '' ) ;
76+ } ) ;
77+
5178test ( 'enables type checking only with --type-check' , ( ) => {
5279 writeLintConfig ( ) ;
5380 writeProjectFile (
0 commit comments