@@ -15,10 +15,11 @@ import {
15
15
import { postprocessArguments } from "./__fixtures__/postprocessArguments" ;
16
16
17
17
const [ messages , filename ] = postprocessArguments ;
18
+ const untrackedFilename = "an-untracked-file.js" ;
18
19
19
20
const gitMocked : jest . MockedObjectDeep < typeof git > = jest . mocked ( git ) ;
20
21
gitMocked . getDiffFileList . mockReturnValue ( [ filename ] ) ;
21
- gitMocked . getUntrackedFileList . mockReturnValue ( [ ] ) ;
22
+ gitMocked . getUntrackedFileList . mockReturnValue ( [ untrackedFilename ] ) ;
22
23
23
24
describe ( "processors" , ( ) => {
24
25
it ( "preprocess (diff and staged)" , async ( ) => {
@@ -53,6 +54,20 @@ describe("processors", () => {
53
54
) ;
54
55
} ) ;
55
56
57
+ it ( "diff postprocess for untracked files with messages" , async ( ) => {
58
+ gitMocked . getDiffForFile . mockReturnValue ( fixtureDiff ) ;
59
+
60
+ const { staged : stagedProcessors } = await import ( "./processors" ) ;
61
+
62
+ const untrackedFilesMessages : Linter . LintMessage [ ] = [
63
+ { ruleId : "mock" , severity : 1 , message : "mock msg" , line : 1 , column : 1 } ,
64
+ ] ;
65
+
66
+ expect (
67
+ stagedProcessors . postprocess ( [ untrackedFilesMessages ] , untrackedFilename )
68
+ ) . toEqual ( untrackedFilesMessages ) ;
69
+ } ) ;
70
+
56
71
it ( "staged postprocess" , async ( ) => {
57
72
gitMocked . hasCleanIndex . mockReturnValueOnce ( true ) ;
58
73
gitMocked . getDiffForFile . mockReturnValueOnce ( fixtureStaged ) ;
0 commit comments