@@ -6,7 +6,7 @@ import { createStubConverter } from "../lintConfigs/rules/ruleConverter.stubs";
6
6
import { convertFileComments , ConvertFileCommentsDependencies } from "./convertFileComments" ;
7
7
8
8
const createStubDependencies = (
9
- readFileResult : string | Error ,
9
+ readFileResult : string | NodeJS . ErrnoException ,
10
10
) : ConvertFileCommentsDependencies => ( {
11
11
converters : new Map ( [
12
12
[ "ts-a" , createStubConverter ( [ "es-a" ] ) ] ,
@@ -39,6 +39,24 @@ describe("convertFileComments", () => {
39
39
expect ( result ) . toBe ( readFileError ) ;
40
40
} ) ;
41
41
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
+
42
60
it ( "doesn't overwrite a file when there are no matching comment directives" , async ( ) => {
43
61
// Arrange
44
62
const dependencies = createStubDependencies ( `
0 commit comments