Skip to content

Commit da31150

Browse files
committed
Increase coverage
1 parent a906b19 commit da31150

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ module.exports = {
77
coveragePathIgnorePatterns: [".test-d.ts"],
88
coverageThreshold: {
99
global: {
10-
statements: 99,
11-
branches: 87,
10+
statements: 100,
11+
branches: 89,
1212
functions: 100,
13-
lines: 99,
13+
lines: 100,
1414
},
1515
},
1616
};

src/processors.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ describe("processors", () => {
9292
diffProcessors.postprocess(messagesWithFatal, filename)
9393
).toHaveLength(3);
9494
});
95+
96+
it("should report fatal errors for staged postprocess with unclean index", async () => {
97+
gitMocked.hasCleanIndex.mockReturnValueOnce(false);
98+
gitMocked.getDiffForFile.mockReturnValueOnce(fixtureStaged);
99+
100+
const { staged: stagedProcessors } = await import("./processors");
101+
102+
const fileWithDirtyIndex = "file-with-dirty-index.js";
103+
const [errorMessage] = stagedProcessors.postprocess(
104+
messages,
105+
fileWithDirtyIndex
106+
);
107+
108+
expect(errorMessage?.fatal).toBe(true);
109+
expect(errorMessage?.message).toMatchInlineSnapshot(
110+
`"file-with-dirty-index.js has unstaged changes. Please stage or remove the changes."`
111+
);
112+
});
95113
});
96114

97115
describe("configs", () => {

0 commit comments

Comments
 (0)