File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -68,4 +68,31 @@ describe('lint-staged', () => {
68
68
console = globalConsoleTemp
69
69
} )
70
70
)
71
+
72
+ test (
73
+ 'supports staged deleted files' ,
74
+ withGitIntegration ( async ( { appendFile, cwd, execGit } ) => {
75
+ const globalConsoleTemp = console
76
+ console = makeConsoleMock ( )
77
+
78
+ // Stage and commit ugly file
79
+ await appendFile ( 'test.js' , fileFixtures . uglyJS )
80
+ await execGit ( [ 'add' , 'test.js' ] )
81
+ await execGit ( [ 'commit' , '-m' , 'test' ] )
82
+
83
+ // Staged deleted file
84
+ await execGit ( [ 'rm' , 'test.js' ] )
85
+
86
+ // Run lint-staged with `--diff-filter=D` to include only deleted files.
87
+ const passed = await lintStaged ( {
88
+ config : { '*.js' : 'prettier --list-different' } ,
89
+ cwd,
90
+ diffFilter : 'D' ,
91
+ } )
92
+
93
+ expect ( passed ) . toEqual ( true )
94
+
95
+ console = globalConsoleTemp
96
+ } )
97
+ )
71
98
} )
You can’t perform that action at this time.
0 commit comments