@@ -39,16 +39,21 @@ suite('Artificial Panics', () => {
39
39
process . env . FORCE_PANIC_PRISMA_FMT = '1'
40
40
41
41
let calledCount = 0
42
+ let calledArg : undefined | unknown = undefined
42
43
43
- const onError = ( ) => {
44
+ // No official mock implementation in mocha
45
+ // -> DIY mock for onError
46
+ const onError = ( arg : unknown ) => {
44
47
calledCount += 1
48
+ calledArg = arg
45
49
}
46
50
47
51
try {
48
52
const _codeActions = handleCodeActions ( params , document , onError )
49
53
50
54
assert . fail ( "This shouldn't happen!" )
51
55
} catch ( e ) {
56
+ assert . ok ( calledArg )
52
57
assert . ok ( calledCount == 1 )
53
58
} finally {
54
59
process . env = { ...OLD_ENV }
@@ -70,16 +75,19 @@ suite('Artificial Panics', () => {
70
75
process . env . FORCE_PANIC_PRISMA_FMT = '1'
71
76
72
77
let calledCount = 0
78
+ let calledArg : undefined | unknown = undefined
73
79
74
- const onError = ( ) => {
80
+ const onError = ( arg : unknown ) => {
75
81
calledCount += 1
82
+ calledArg = arg
76
83
}
77
84
78
85
try {
79
86
const _formatResult : TextEdit [ ] = handleDocumentFormatting ( params , document , onError )
80
87
81
88
assert . fail ( "This shouldn't happen!" )
82
89
} catch ( e ) {
90
+ assert . ok ( calledArg )
83
91
assert . ok ( calledCount == 1 )
84
92
} finally {
85
93
process . env = { ...OLD_ENV }
@@ -93,16 +101,19 @@ suite('Artificial Panics', () => {
93
101
process . env . FORCE_PANIC_PRISMA_FMT = '1'
94
102
95
103
let calledCount = 0
104
+ let calledArg : undefined | unknown = undefined
96
105
97
- const onError = ( ) => {
106
+ const onError = ( arg : unknown ) => {
98
107
calledCount += 1
108
+ calledArg = arg
99
109
}
100
110
101
111
try {
102
112
const _diagnostics = handleDiagnosticsRequest ( document , onError )
103
113
104
114
assert . fail ( "This shouldn't happen!" )
105
115
} catch ( e ) {
116
+ assert . ok ( calledArg )
106
117
assert . ok ( calledCount == 1 )
107
118
} finally {
108
119
process . env = { ...OLD_ENV }
@@ -132,16 +143,19 @@ suite('Artificial Panics', () => {
132
143
process . env . FORCE_PANIC_PRISMA_FMT_LOCAL = '1'
133
144
134
145
let calledCount = 0
146
+ let calledArg : undefined | unknown = undefined
135
147
136
- const onError = ( ) => {
148
+ const onError = ( arg : unknown ) => {
137
149
calledCount += 1
150
+ calledArg = arg
138
151
}
139
152
140
153
try {
141
154
const _completions = handleCompletionRequest ( params , document , onError )
142
155
143
156
assert . fail ( "This shouldn't happen!" )
144
157
} catch ( e ) {
158
+ assert . ok ( calledArg )
145
159
assert . ok ( calledCount == 1 )
146
160
} finally {
147
161
process . env = { ...OLD_ENV }
@@ -171,16 +185,19 @@ suite('Artificial Panics', () => {
171
185
process . env . FORCE_PANIC_PRISMA_FMT_LOCAL = '1'
172
186
173
187
let calledCount = 0
188
+ let calledArg : undefined | unknown = undefined
174
189
175
- const onError = ( ) => {
190
+ const onError = ( arg : unknown ) => {
176
191
calledCount += 1
192
+ calledArg = arg
177
193
}
178
194
179
195
try {
180
196
const _completions = handleCompletionRequest ( params , document , onError )
181
197
182
198
assert . fail ( "This shouldn't happen!" )
183
199
} catch ( e ) {
200
+ assert . ok ( calledArg )
184
201
assert . ok ( calledCount == 1 )
185
202
} finally {
186
203
process . env = { ...OLD_ENV }
@@ -199,16 +216,19 @@ suite('Artificial Panics', () => {
199
216
process . env . FORCE_PANIC_PRISMA_FMT = '1'
200
217
201
218
let calledCount = 0
219
+ let calledArg : undefined | unknown = undefined
202
220
203
- const onError = ( ) => {
221
+ const onError = ( arg : unknown ) => {
204
222
calledCount += 1
223
+ calledArg = arg
205
224
}
206
225
207
226
try {
208
227
const _completions = handleCompletionRequest ( params , document , onError )
209
228
210
229
assert . fail ( "This shouldn't happen!" )
211
230
} catch ( e ) {
231
+ assert . ok ( calledArg )
212
232
assert . ok ( calledCount == 1 )
213
233
} finally {
214
234
process . env = { ...OLD_ENV }
0 commit comments