Skip to content

Commit 490475d

Browse files
committed
test: Fix codecov
1 parent cca08ee commit 490475d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/converters/comments/convertFileComments.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createStubConverter } from "../lintConfigs/rules/ruleConverter.stubs";
66
import { convertFileComments, ConvertFileCommentsDependencies } from "./convertFileComments";
77

88
const createStubDependencies = (
9-
readFileResult: string | Error,
9+
readFileResult: string | NodeJS.ErrnoException,
1010
): ConvertFileCommentsDependencies => ({
1111
converters: new Map([
1212
["ts-a", createStubConverter(["es-a"])],
@@ -39,6 +39,24 @@ describe("convertFileComments", () => {
3939
expect(result).toBe(readFileError);
4040
});
4141

42+
it("ignores the failure when attempting to read a directory", async () => {
43+
// Arrange
44+
const readDirError = new Error() as NodeJS.ErrnoException;
45+
readDirError.code = "EISDIR";
46+
const dependencies = createStubDependencies(readDirError);
47+
48+
// Act
49+
const result = await convertFileComments(
50+
dependencies,
51+
stubFileName,
52+
new Map<string, string[]>(),
53+
new Map<string, string[]>(),
54+
);
55+
56+
// Assert
57+
expect(result).toBe(undefined);
58+
});
59+
4260
it("doesn't overwrite a file when there are no matching comment directives", async () => {
4361
// Arrange
4462
const dependencies = createStubDependencies(`

0 commit comments

Comments
 (0)