Commit c154bae 1 parent f87f18f commit c154bae Copy full SHA for c154bae
File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -124,13 +124,28 @@ const TSESLintPluginRef: { throwWhenRequiring: boolean } = {
124
124
125
125
jest . mock ( '@typescript-eslint/eslint-plugin' , ( ) => {
126
126
if ( TSESLintPluginRef . throwWhenRequiring ) {
127
- throw new Error ( 'oh noes!' ) ;
127
+ throw new ( class extends Error {
128
+ public code = 'MODULE_NOT_FOUND' ;
129
+ } ) ( ) ;
128
130
}
129
131
130
132
return jest . requireActual ( '@typescript-eslint/eslint-plugin' ) ;
131
133
} ) ;
132
134
133
135
describe ( 'error handling' , ( ) => {
136
+ describe ( 'when an error is thrown accessing the base rule' , ( ) => {
137
+ it ( 're-throws the error' , ( ) => {
138
+ jest . mock ( '@typescript-eslint/eslint-plugin' , ( ) => {
139
+ throw new Error ( 'oh noes!' ) ;
140
+ } ) ;
141
+
142
+ jest . resetModuleRegistry ( ) ;
143
+
144
+ // eslint-disable-next-line @typescript-eslint/no-require-imports,node/no-missing-require
145
+ expect ( ( ) => require ( '../unbound-method' ) . default ) . toThrow ( / o h n o e s ! / iu) ;
146
+ } ) ;
147
+ } ) ;
148
+
134
149
describe ( 'when @typescript-eslint/eslint-plugin is not available' , ( ) => {
135
150
const ruleTester = new ESLintUtils . RuleTester ( {
136
151
parser : '@typescript-eslint/parser' ,
You can’t perform that action at this time.
0 commit comments