@@ -58,15 +58,21 @@ describe("config", function () {
5858 const parseAndReturnErrorMessage = ( config : unknown ) => {
5959 try {
6060 validateUserConfig ( config , "/path/to/config.js" ) ;
61- } catch ( error : any ) {
62- return error ;
61+ } catch ( error : unknown ) {
62+ if ( error instanceof SlippyInvalidConfigError ) {
63+ return error ;
64+ }
65+
66+ throw error ;
6367 }
6468 } ;
6569
6670 it ( "undefined config" , function ( ) {
6771 const error = parseAndReturnErrorMessage ( undefined ) ;
6872
69- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
73+ if ( error === undefined ) {
74+ expect . fail ( ) ;
75+ }
7076 expect ( error . message ) . toMatchInlineSnapshot (
7177 `"Invalid config at '/path/to/config.js': Configuration must be an object"` ,
7278 ) ;
@@ -78,7 +84,9 @@ describe("config", function () {
7884 it ( "unknown key" , function ( ) {
7985 const error = parseAndReturnErrorMessage ( { invalidKey : { } } ) ;
8086
81- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
87+ if ( error === undefined ) {
88+ expect . fail ( ) ;
89+ }
8290 expect ( error . message ) . toMatchInlineSnapshot ( `
8391 "Invalid config at '/path/to/config.js':
8492
@@ -91,7 +99,9 @@ describe("config", function () {
9199 rules : { "some-rule" : "erro" } ,
92100 } ) ;
93101
94- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
102+ if ( error === undefined ) {
103+ expect . fail ( ) ;
104+ }
95105 expect ( error . message ) . toMatchInlineSnapshot ( `
96106 "Invalid config at '/path/to/config.js':
97107
@@ -105,7 +115,9 @@ describe("config", function () {
105115 rules : { "some-rule" : [ "erro" ] } ,
106116 } ) ;
107117
108- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
118+ if ( error === undefined ) {
119+ expect . fail ( ) ;
120+ }
109121 expect ( error . message ) . toMatchInlineSnapshot ( `
110122 "Invalid config at '/path/to/config.js':
111123
@@ -117,7 +129,9 @@ describe("config", function () {
117129 it ( "rule config is empty array" , function ( ) {
118130 const error = parseAndReturnErrorMessage ( { rules : { "some-rule" : [ ] } } ) ;
119131
120- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
132+ if ( error === undefined ) {
133+ expect . fail ( ) ;
134+ }
121135 expect ( error . message ) . toMatchInlineSnapshot ( `
122136 "Invalid config at '/path/to/config.js':
123137
@@ -131,7 +145,9 @@ describe("config", function () {
131145 rules : { "some-rule" : [ "error" , { } , { } ] } ,
132146 } ) ;
133147
134- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
148+ if ( error === undefined ) {
149+ expect . fail ( ) ;
150+ }
135151 expect ( error . message ) . toMatchInlineSnapshot ( `
136152 "Invalid config at '/path/to/config.js':
137153
@@ -143,7 +159,9 @@ describe("config", function () {
143159 it ( "severity as a level, shorthand" , function ( ) {
144160 const error = parseAndReturnErrorMessage ( { rules : { "some-rule" : 1 } } ) ;
145161
146- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
162+ if ( error === undefined ) {
163+ expect . fail ( ) ;
164+ }
147165 expect ( error . message ) . toMatchInlineSnapshot ( `
148166 "Invalid config at '/path/to/config.js':
149167
@@ -155,7 +173,9 @@ describe("config", function () {
155173 it ( "severity as a level" , function ( ) {
156174 const error = parseAndReturnErrorMessage ( { rules : { "some-rule" : [ 1 ] } } ) ;
157175
158- expect ( error ) . instanceOf ( SlippyInvalidConfigError ) ;
176+ if ( error === undefined ) {
177+ expect . fail ( ) ;
178+ }
159179 expect ( error . message ) . toMatchInlineSnapshot ( `
160180 "Invalid config at '/path/to/config.js':
161181
0 commit comments