@@ -167,11 +167,6 @@ describe('MessageQueue', function() {
167
167
} ) . toThrow ( ) ;
168
168
await expect ( promise1 ) . rejects . toBeInstanceOf ( Error ) ;
169
169
await expect ( promise1 ) . rejects . toMatchObject ( { message : 'firstFailure' } ) ;
170
- // Check that we get a useful stack trace from failures.
171
- const error = await promise1 . catch ( x => x ) ;
172
- expect ( getLineFromFrame ( parseErrorStack ( error ) [ 0 ] ) ) . toContain (
173
- 'NativeModules.RemoteModule1.promiseReturningMethod(' ,
174
- ) ;
175
170
176
171
// Handle the second remote invocation by signaling success.
177
172
BatchedBridge . __invokeCallback ( secondSuccCBID , [ 'secondSucc' ] ) ;
@@ -211,36 +206,6 @@ describe('MessageQueue', function() {
211
206
} ) ;
212
207
} ) ;
213
208
214
- it ( 'throwing a "native" exception gets framesToPop = 2' , function ( ) {
215
- global . nativeCallSyncHook = ( ) => {
216
- throw new Error ( 'Exception in HostFunction: foo' ) ;
217
- } ;
218
- let error ;
219
- try {
220
- NativeModules . RemoteModule1 . syncMethod ( 'paloAlto' , 'menloPark' ) ;
221
- } catch ( e ) {
222
- error = e ;
223
- }
224
- // We can't test this behaviour with `getLineFromFrame` because our mock
225
- // function adds an extra frame, so check `framesToPop` directly instead.
226
- expect ( error . framesToPop ) . toBe ( 2 ) ;
227
- } ) ;
228
-
229
- it ( 'throwing a "native" exception preserves framesToPop if set' , function ( ) {
230
- global . nativeCallSyncHook = ( ) => {
231
- const e = new Error ( 'Exception in HostFunction: foo' ) ;
232
- e . framesToPop = 42 ;
233
- throw e ;
234
- } ;
235
- let error ;
236
- try {
237
- NativeModules . RemoteModule1 . syncMethod ( 'paloAlto' , 'menloPark' ) ;
238
- } catch ( e ) {
239
- error = e ;
240
- }
241
- expect ( error . framesToPop ) . toBe ( 42 ) ;
242
- } ) ;
243
-
244
209
it ( 'returning a value' , function ( ) {
245
210
global . nativeCallSyncHook = jest . fn ( ( ) => {
246
211
return 'secondSucc' ;
@@ -259,24 +224,3 @@ describe('MessageQueue', function() {
259
224
} ) ;
260
225
} ) ;
261
226
} ) ;
262
-
263
- const linesByFile = new Map ( ) ;
264
-
265
- function getLineFromFrame ( { lineNumber /* 1-based */ , file} ) {
266
- if ( file == null ) {
267
- return null ;
268
- }
269
- const cleanedFile = cleanFileName ( file ) ;
270
- const lines =
271
- linesByFile . get ( cleanedFile ) ||
272
- fs . readFileSync ( cleanedFile , 'utf8' ) . split ( '\n' ) ;
273
- if ( ! linesByFile . has ( cleanedFile ) ) {
274
- linesByFile . set ( cleanedFile , lines ) ;
275
- }
276
- return ( lines [ lineNumber - 1 ] || '' ) . trim ( ) ;
277
- }
278
-
279
- // Works around a parseErrorStack bug involving `new X` stack frames.
280
- function cleanFileName ( file ) {
281
- return file . replace ( / ^ .+ ? \( (? = \/ ) / , '' ) ;
282
- }
0 commit comments