@interfere/react 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/__tests__/client.test.d.ts +2 -0
  2. package/dist/__tests__/client.test.d.ts.map +1 -0
  3. package/dist/__tests__/client.test.js +447 -0
  4. package/dist/__tests__/client.test.js.map +1 -0
  5. package/dist/__tests__/lib/core/error-handlers.test.d.ts +2 -0
  6. package/dist/__tests__/lib/core/error-handlers.test.d.ts.map +1 -0
  7. package/dist/__tests__/lib/core/error-handlers.test.js +596 -0
  8. package/dist/__tests__/lib/core/error-handlers.test.js.map +1 -0
  9. package/dist/__tests__/lib/core/event-queue.test.d.ts +2 -0
  10. package/dist/__tests__/lib/core/event-queue.test.d.ts.map +1 -0
  11. package/dist/__tests__/lib/core/event-queue.test.js +290 -0
  12. package/dist/__tests__/lib/core/event-queue.test.js.map +1 -0
  13. package/dist/__tests__/lib/core/runtime.test.d.ts +2 -0
  14. package/dist/__tests__/lib/core/runtime.test.d.ts.map +1 -0
  15. package/dist/__tests__/lib/core/runtime.test.js +133 -0
  16. package/dist/__tests__/lib/core/runtime.test.js.map +1 -0
  17. package/dist/__tests__/lib/core/session-manager.test.d.ts +2 -0
  18. package/dist/__tests__/lib/core/session-manager.test.d.ts.map +1 -0
  19. package/dist/__tests__/lib/core/session-manager.test.js +356 -0
  20. package/dist/__tests__/lib/core/session-manager.test.js.map +1 -0
  21. package/dist/__tests__/provider.test.d.ts +2 -0
  22. package/dist/__tests__/provider.test.d.ts.map +1 -0
  23. package/dist/__tests__/provider.test.js +143 -0
  24. package/dist/__tests__/provider.test.js.map +1 -0
  25. package/dist/client.d.ts +78 -0
  26. package/dist/client.d.ts.map +1 -0
  27. package/dist/client.js +219 -0
  28. package/dist/client.js.map +1 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +5 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/lib/core/error-handlers.d.ts +14 -0
  34. package/dist/lib/core/error-handlers.d.ts.map +1 -0
  35. package/dist/lib/core/error-handlers.js +191 -0
  36. package/dist/lib/core/error-handlers.js.map +1 -0
  37. package/dist/lib/core/event-queue.d.ts +90 -0
  38. package/dist/lib/core/event-queue.d.ts.map +1 -0
  39. package/dist/lib/core/event-queue.js +286 -0
  40. package/dist/lib/core/event-queue.js.map +1 -0
  41. package/dist/lib/core/runtime.d.ts +7 -0
  42. package/dist/lib/core/runtime.d.ts.map +1 -0
  43. package/dist/lib/core/runtime.js +16 -0
  44. package/dist/lib/core/runtime.js.map +1 -0
  45. package/dist/lib/core/session-manager.d.ts +96 -0
  46. package/dist/lib/core/session-manager.d.ts.map +1 -0
  47. package/dist/lib/core/session-manager.js +431 -0
  48. package/dist/lib/core/session-manager.js.map +1 -0
  49. package/dist/lib/persistence/storage.d.ts +5 -0
  50. package/dist/lib/persistence/storage.d.ts.map +1 -0
  51. package/dist/lib/persistence/storage.js +67 -0
  52. package/dist/lib/persistence/storage.js.map +1 -0
  53. package/dist/lib/session/rage-click.d.ts +2 -0
  54. package/dist/lib/session/rage-click.d.ts.map +1 -0
  55. package/dist/lib/session/rage-click.js +51 -0
  56. package/dist/lib/session/rage-click.js.map +1 -0
  57. package/dist/lib/session/replay.d.ts +3 -0
  58. package/dist/lib/session/replay.d.ts.map +1 -0
  59. package/dist/lib/session/replay.js +106 -0
  60. package/dist/lib/session/replay.js.map +1 -0
  61. package/dist/lib/session/session-summary.d.ts +3 -0
  62. package/dist/lib/session/session-summary.d.ts.map +1 -0
  63. package/dist/lib/session/session-summary.js +79 -0
  64. package/dist/lib/session/session-summary.js.map +1 -0
  65. package/dist/provider.d.ts +76 -0
  66. package/dist/provider.d.ts.map +1 -0
  67. package/dist/provider.js +138 -0
  68. package/dist/provider.js.map +1 -0
  69. package/package.json +73 -0
@@ -0,0 +1,596 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { captureApiRouteError, captureErrorBoundaryError, captureServerError, setupClientErrorHandlers, withErrorCapture, } from "../../../lib/core/error-handlers.js";
3
+ // Mock the capture function
4
+ const mockCapture = vi.fn();
5
+ // Constants for testing
6
+ const TEST_TIMESTAMP = 1_234_567_890;
7
+ const TEST_LINE_NUMBER = 10;
8
+ const TEST_COLUMN_NUMBER = 5;
9
+ const TEST_PORT = 404;
10
+ const ASYNC_RESULT_A = 2;
11
+ const ASYNC_RESULT_B = 3;
12
+ const ASYNC_RESULT_EXPECTED = 5;
13
+ vi.mock("../../../client.js", () => ({
14
+ capture: (...args) => mockCapture(...args),
15
+ }));
16
+ describe("error-handlers", () => {
17
+ beforeEach(() => {
18
+ vi.clearAllMocks();
19
+ // Reset global objects
20
+ if (typeof window !== "undefined") {
21
+ vi.stubGlobal("window", undefined);
22
+ }
23
+ // Ensure EdgeRuntime is fully removed (property deleted, not set to undefined)
24
+ if (Reflect.has(globalThis, "EdgeRuntime")) {
25
+ Reflect.deleteProperty(globalThis, "EdgeRuntime");
26
+ }
27
+ });
28
+ afterEach(() => {
29
+ vi.restoreAllMocks();
30
+ // Ensure EdgeRuntime is fully removed between tests
31
+ if (Reflect.has(globalThis, "EdgeRuntime")) {
32
+ Reflect.deleteProperty(globalThis, "EdgeRuntime");
33
+ }
34
+ });
35
+ describe("setupClientErrorHandlers", () => {
36
+ it("should not setup handlers when window is undefined", () => {
37
+ // Ensure window is undefined
38
+ vi.stubGlobal("window", undefined);
39
+ const addEventListenerSpy = vi.fn();
40
+ setupClientErrorHandlers();
41
+ expect(addEventListenerSpy).not.toHaveBeenCalled();
42
+ });
43
+ it("should setup error event listener on window", () => {
44
+ const mockWindow = {
45
+ addEventListener: vi.fn(),
46
+ location: { href: "https://example.com/page" },
47
+ };
48
+ const mockNavigator = {
49
+ userAgent: "TestAgent/1.0",
50
+ };
51
+ vi.stubGlobal("window", mockWindow);
52
+ vi.stubGlobal("navigator", mockNavigator);
53
+ vi.stubGlobal("console", {
54
+ ...console,
55
+ error: vi.fn(),
56
+ });
57
+ setupClientErrorHandlers();
58
+ expect(mockWindow.addEventListener).toHaveBeenCalledWith("error", expect.any(Function));
59
+ expect(mockWindow.addEventListener).toHaveBeenCalledWith("unhandledrejection", expect.any(Function));
60
+ });
61
+ it("should handle window error events", () => {
62
+ const mockWindow = {
63
+ addEventListener: vi.fn(),
64
+ location: { href: "https://example.com/page" },
65
+ };
66
+ const mockNavigator = {
67
+ userAgent: "TestAgent/1.0",
68
+ };
69
+ vi.stubGlobal("window", mockWindow);
70
+ vi.stubGlobal("navigator", mockNavigator);
71
+ vi.stubGlobal("console", {
72
+ ...console,
73
+ error: vi.fn(),
74
+ });
75
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
76
+ setupClientErrorHandlers();
77
+ // Get the error handler that was registered
78
+ const errorHandler = mockWindow.addEventListener.mock.calls.find((call) => call[0] === "error")?.[1];
79
+ // Simulate an error event
80
+ const errorEvent = {
81
+ message: "Test error",
82
+ filename: "test.js",
83
+ lineno: TEST_LINE_NUMBER,
84
+ colno: TEST_COLUMN_NUMBER,
85
+ error: { stack: "Error stack trace" },
86
+ };
87
+ errorHandler(errorEvent);
88
+ expect(mockCapture).toHaveBeenCalledWith("error", {
89
+ type: "unhandled_error",
90
+ error: {
91
+ message: "Test error",
92
+ name: "WindowError",
93
+ fileName: "test.js",
94
+ lineNumber: TEST_LINE_NUMBER,
95
+ columnNumber: TEST_COLUMN_NUMBER,
96
+ stack: "Error stack trace",
97
+ },
98
+ url: "https://example.com/page",
99
+ userAgent: "TestAgent/1.0",
100
+ timestamp: TEST_TIMESTAMP,
101
+ });
102
+ mockDateNow.mockRestore();
103
+ });
104
+ it("should handle unhandled promise rejections", () => {
105
+ const mockWindow = {
106
+ addEventListener: vi.fn(),
107
+ location: { href: "https://example.com/page" },
108
+ };
109
+ const mockNavigator = {
110
+ userAgent: "TestAgent/1.0",
111
+ };
112
+ vi.stubGlobal("window", mockWindow);
113
+ vi.stubGlobal("navigator", mockNavigator);
114
+ vi.stubGlobal("console", {
115
+ ...console,
116
+ error: vi.fn(),
117
+ });
118
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
119
+ setupClientErrorHandlers();
120
+ // Get the unhandledrejection handler
121
+ const rejectionHandler = mockWindow.addEventListener.mock.calls.find((call) => call[0] === "unhandledrejection")?.[1];
122
+ // Simulate a rejection event with an Error
123
+ const error = new Error("Promise rejected");
124
+ const rejectionEvent = {
125
+ reason: error,
126
+ };
127
+ rejectionHandler(rejectionEvent);
128
+ expect(mockCapture).toHaveBeenCalledWith("error", {
129
+ type: "unhandled_rejection",
130
+ error: {
131
+ message: "Promise rejected",
132
+ name: "Error",
133
+ stack: expect.any(String),
134
+ cause: undefined,
135
+ },
136
+ url: "https://example.com/page",
137
+ userAgent: "TestAgent/1.0",
138
+ timestamp: TEST_TIMESTAMP,
139
+ });
140
+ mockDateNow.mockRestore();
141
+ });
142
+ it("should override console.error and capture logs", () => {
143
+ const mockWindow = {
144
+ addEventListener: vi.fn(),
145
+ location: { href: "https://example.com/page" },
146
+ };
147
+ vi.stubGlobal("window", mockWindow);
148
+ const originalConsoleError = vi.fn();
149
+ vi.stubGlobal("console", {
150
+ ...console,
151
+ error: originalConsoleError,
152
+ });
153
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
154
+ setupClientErrorHandlers();
155
+ // Call the overridden console.error
156
+ console.error("Error message", { detail: "error detail" });
157
+ // Should call original console.error
158
+ expect(originalConsoleError).toHaveBeenCalledWith("Error message", {
159
+ detail: "error detail",
160
+ });
161
+ // Should capture the error
162
+ expect(mockCapture).toHaveBeenCalledWith("error", {
163
+ type: "console_error",
164
+ message: 'Error message {"detail":"error detail"}',
165
+ url: "https://example.com/page",
166
+ timestamp: TEST_TIMESTAMP,
167
+ });
168
+ mockDateNow.mockRestore();
169
+ });
170
+ it("should handle console.error with non-serializable objects", () => {
171
+ const mockWindow = {
172
+ addEventListener: vi.fn(),
173
+ location: { href: "https://example.com/page" },
174
+ };
175
+ vi.stubGlobal("window", mockWindow);
176
+ const originalConsoleError = vi.fn();
177
+ vi.stubGlobal("console", {
178
+ ...console,
179
+ error: originalConsoleError,
180
+ });
181
+ setupClientErrorHandlers();
182
+ // Create a circular reference object
183
+ const circularObj = {};
184
+ circularObj.self = circularObj;
185
+ console.error("Error with circular", circularObj);
186
+ // Should still call capture with String representation
187
+ expect(mockCapture).toHaveBeenCalledWith("error", {
188
+ type: "console_error",
189
+ message: expect.stringContaining("Error with circular"),
190
+ url: "https://example.com/page",
191
+ timestamp: expect.any(Number),
192
+ });
193
+ });
194
+ });
195
+ describe("captureServerError", () => {
196
+ it("should capture server error without request", () => {
197
+ const error = new Error("Server error");
198
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
199
+ captureServerError(error);
200
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
201
+ type: "server_error",
202
+ error: {
203
+ message: "Server error",
204
+ name: "Error",
205
+ stack: expect.any(String),
206
+ cause: undefined,
207
+ },
208
+ request: undefined,
209
+ context: undefined,
210
+ timestamp: TEST_TIMESTAMP,
211
+ });
212
+ mockDateNow.mockRestore();
213
+ });
214
+ it("should capture server error with request and context", () => {
215
+ const error = new Error("Server error");
216
+ const request = new Request("https://example.com/api/test", {
217
+ method: "POST",
218
+ headers: {
219
+ "Content-Type": "application/json",
220
+ },
221
+ });
222
+ const context = {
223
+ pathname: "/api/test",
224
+ renderingError: true,
225
+ customData: "test",
226
+ };
227
+ captureServerError(error, request, context);
228
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
229
+ type: "server_error",
230
+ error: {
231
+ message: "Server error",
232
+ name: "Error",
233
+ stack: expect.any(String),
234
+ cause: undefined,
235
+ },
236
+ request: {
237
+ url: "https://example.com/api/test",
238
+ method: "POST",
239
+ headers: {
240
+ "content-type": "application/json",
241
+ },
242
+ },
243
+ context,
244
+ timestamp: expect.any(Number),
245
+ });
246
+ });
247
+ it("should capture edge runtime errors", () => {
248
+ // Mock EdgeRuntime global
249
+ const originalEdgeRuntime = globalThis
250
+ .EdgeRuntime;
251
+ globalThis.EdgeRuntime = "edge";
252
+ const error = new Error("Edge error");
253
+ captureServerError(error);
254
+ expect(mockCapture).toHaveBeenCalledWith("edge_error", {
255
+ type: "server_error",
256
+ error: {
257
+ message: "Edge error",
258
+ name: "Error",
259
+ stack: expect.any(String),
260
+ cause: undefined,
261
+ },
262
+ request: undefined,
263
+ context: undefined,
264
+ timestamp: expect.any(Number),
265
+ });
266
+ // Clean up: delete property if it didn't exist originally
267
+ if (originalEdgeRuntime === undefined) {
268
+ Reflect.deleteProperty(globalThis, "EdgeRuntime");
269
+ }
270
+ else {
271
+ Reflect.set(globalThis, "EdgeRuntime", originalEdgeRuntime);
272
+ }
273
+ });
274
+ it("should handle string errors", () => {
275
+ const error = "String error message";
276
+ captureServerError(error);
277
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
278
+ type: "server_error",
279
+ error: {
280
+ message: "String error message",
281
+ name: "Error",
282
+ },
283
+ request: undefined,
284
+ context: undefined,
285
+ timestamp: expect.any(Number),
286
+ });
287
+ });
288
+ it("should handle unknown error types", () => {
289
+ const error = { custom: "error object" };
290
+ captureServerError(error);
291
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
292
+ type: "server_error",
293
+ error: {
294
+ message: "[object Object]",
295
+ name: "UnknownError",
296
+ },
297
+ request: undefined,
298
+ context: undefined,
299
+ timestamp: expect.any(Number),
300
+ });
301
+ });
302
+ });
303
+ describe("captureErrorBoundaryError", () => {
304
+ it("should capture error boundary errors", () => {
305
+ const mockWindow = {
306
+ location: { href: "https://example.com/page" },
307
+ };
308
+ vi.stubGlobal("window", mockWindow);
309
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
310
+ const error = new Error("Component error");
311
+ const errorInfo = {
312
+ componentStack: "at Component\n at ErrorBoundary",
313
+ };
314
+ captureErrorBoundaryError(error, errorInfo);
315
+ expect(mockCapture).toHaveBeenCalledWith("error", {
316
+ type: "error_boundary",
317
+ error: {
318
+ message: "Component error",
319
+ name: "Error",
320
+ stack: expect.any(String),
321
+ cause: undefined,
322
+ },
323
+ componentStack: "at Component\n at ErrorBoundary",
324
+ url: "https://example.com/page",
325
+ timestamp: TEST_TIMESTAMP,
326
+ });
327
+ mockDateNow.mockRestore();
328
+ });
329
+ it("should handle error boundary without window", () => {
330
+ vi.stubGlobal("window", undefined);
331
+ const error = new Error("Component error");
332
+ const errorInfo = {
333
+ componentStack: "at Component",
334
+ };
335
+ captureErrorBoundaryError(error, errorInfo);
336
+ expect(mockCapture).toHaveBeenCalledWith("error", {
337
+ type: "error_boundary",
338
+ error: {
339
+ message: "Component error",
340
+ name: "Error",
341
+ stack: expect.any(String),
342
+ cause: undefined,
343
+ },
344
+ componentStack: "at Component",
345
+ url: undefined,
346
+ timestamp: expect.any(Number),
347
+ });
348
+ });
349
+ });
350
+ describe("captureApiRouteError", () => {
351
+ it("should capture API route errors", () => {
352
+ const error = new Error("API error");
353
+ const req = new Request("https://api.example.com/users", {
354
+ method: "POST",
355
+ headers: {
356
+ "Content-Type": "application/json",
357
+ Authorization: "Bearer token",
358
+ },
359
+ });
360
+ const pathname = "/api/users";
361
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
362
+ captureApiRouteError(error, req, pathname);
363
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
364
+ type: "api_route_error",
365
+ error: {
366
+ message: "API error",
367
+ name: "Error",
368
+ stack: expect.any(String),
369
+ cause: undefined,
370
+ },
371
+ request: {
372
+ url: "https://api.example.com/users",
373
+ method: "POST",
374
+ headers: {
375
+ authorization: "Bearer token",
376
+ "content-type": "application/json",
377
+ },
378
+ pathname: "/api/users",
379
+ },
380
+ timestamp: TEST_TIMESTAMP,
381
+ });
382
+ mockDateNow.mockRestore();
383
+ });
384
+ });
385
+ describe("withErrorCapture", () => {
386
+ it("should wrap async function and return result on success", async () => {
387
+ const asyncFn = async (a, b) => a + b;
388
+ const spy = vi.fn(asyncFn);
389
+ const wrapped = withErrorCapture(spy);
390
+ const result = await wrapped(ASYNC_RESULT_A, ASYNC_RESULT_B);
391
+ expect(result).toBe(ASYNC_RESULT_EXPECTED);
392
+ expect(spy).toHaveBeenCalledWith(ASYNC_RESULT_A, ASYNC_RESULT_B);
393
+ expect(mockCapture).not.toHaveBeenCalled();
394
+ });
395
+ it("should capture error and rethrow when async function fails", async () => {
396
+ const error = new Error("Async error");
397
+ const asyncFn = async () => {
398
+ await Promise.resolve();
399
+ throw error;
400
+ };
401
+ const wrapped = withErrorCapture(asyncFn, { customContext: "test" });
402
+ const mockDateNow = vi.spyOn(Date, "now").mockReturnValue(TEST_TIMESTAMP);
403
+ await expect(wrapped()).rejects.toThrow("Async error");
404
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
405
+ type: "wrapped_function_error",
406
+ error: {
407
+ message: "Async error",
408
+ name: "Error",
409
+ stack: expect.any(String),
410
+ cause: undefined,
411
+ },
412
+ functionName: "asyncFn",
413
+ context: { customContext: "test" },
414
+ timestamp: TEST_TIMESTAMP,
415
+ });
416
+ mockDateNow.mockRestore();
417
+ });
418
+ it("should handle anonymous functions", async () => {
419
+ const error = new Error("Anonymous error");
420
+ const wrapped = withErrorCapture(async () => {
421
+ await Promise.resolve();
422
+ throw error;
423
+ });
424
+ await expect(wrapped()).rejects.toThrow("Anonymous error");
425
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
426
+ type: "wrapped_function_error",
427
+ error: {
428
+ message: "Anonymous error",
429
+ name: "Error",
430
+ stack: expect.any(String),
431
+ cause: undefined,
432
+ },
433
+ functionName: "anonymous",
434
+ context: undefined,
435
+ timestamp: expect.any(Number),
436
+ });
437
+ });
438
+ it("should detect client runtime in wrapped functions", async () => {
439
+ const mockWindow = {
440
+ location: { href: "https://example.com" },
441
+ };
442
+ vi.stubGlobal("window", mockWindow);
443
+ const error = new Error("Client error");
444
+ const wrapped = withErrorCapture(async () => {
445
+ await Promise.resolve();
446
+ throw error;
447
+ });
448
+ await expect(wrapped()).rejects.toThrow("Client error");
449
+ expect(mockCapture).toHaveBeenCalledWith("error", {
450
+ type: "wrapped_function_error",
451
+ error: expect.objectContaining({
452
+ message: "Client error",
453
+ }),
454
+ functionName: "anonymous",
455
+ context: undefined,
456
+ timestamp: expect.any(Number),
457
+ });
458
+ });
459
+ it("should detect edge runtime in wrapped functions", async () => {
460
+ const originalEdgeRuntime = globalThis
461
+ .EdgeRuntime;
462
+ globalThis.EdgeRuntime = "edge";
463
+ const error = new Error("Edge error");
464
+ const wrapped = withErrorCapture(async () => {
465
+ await Promise.resolve();
466
+ throw error;
467
+ });
468
+ await expect(wrapped()).rejects.toThrow("Edge error");
469
+ expect(mockCapture).toHaveBeenCalledWith("edge_error", {
470
+ type: "wrapped_function_error",
471
+ error: expect.objectContaining({
472
+ message: "Edge error",
473
+ }),
474
+ functionName: "anonymous",
475
+ context: undefined,
476
+ timestamp: expect.any(Number),
477
+ });
478
+ // Clean up: delete property if it didn't exist originally
479
+ if (originalEdgeRuntime === undefined) {
480
+ Reflect.deleteProperty(globalThis, "EdgeRuntime");
481
+ }
482
+ else {
483
+ Reflect.set(globalThis, "EdgeRuntime", originalEdgeRuntime);
484
+ }
485
+ });
486
+ });
487
+ describe("safeCapture", () => {
488
+ it("should prevent recursive captures", () => {
489
+ const mockWindow = {
490
+ addEventListener: vi.fn(),
491
+ location: { href: "https://example.com/page" },
492
+ };
493
+ const mockNavigator = {
494
+ userAgent: "TestAgent/1.0",
495
+ };
496
+ vi.stubGlobal("window", mockWindow);
497
+ vi.stubGlobal("navigator", mockNavigator);
498
+ // Setup error handlers
499
+ setupClientErrorHandlers();
500
+ // Get the error handler
501
+ const errorHandler = mockWindow.addEventListener.mock.calls.find((call) => call[0] === "error")?.[1];
502
+ // Make capture throw an error to test recursive protection
503
+ mockCapture.mockImplementation(() => {
504
+ // Try to trigger another error event
505
+ const nestedError = {
506
+ message: "Nested error",
507
+ filename: "nested.js",
508
+ lineno: 1,
509
+ colno: 1,
510
+ error: new Error("Nested"),
511
+ };
512
+ errorHandler(nestedError);
513
+ // If we get here, recursive protection didn't work
514
+ throw new Error("Capture error");
515
+ });
516
+ const errorEvent = {
517
+ message: "Test error",
518
+ filename: "test.js",
519
+ lineno: TEST_LINE_NUMBER,
520
+ colno: TEST_COLUMN_NUMBER,
521
+ error: new Error("Test"),
522
+ };
523
+ // This should not throw despite mockCapture throwing
524
+ expect(() => errorHandler(errorEvent)).not.toThrow();
525
+ // Should only be called once due to recursive protection
526
+ expect(mockCapture).toHaveBeenCalledTimes(1);
527
+ });
528
+ it("should silently handle capture failures", () => {
529
+ mockCapture.mockImplementation(() => {
530
+ throw new Error("SDK not initialized");
531
+ });
532
+ const error = new Error("Test error");
533
+ // Should not throw
534
+ expect(() => captureServerError(error)).not.toThrow();
535
+ });
536
+ });
537
+ describe("error serialization", () => {
538
+ it("should serialize Error with cause", () => {
539
+ const cause = new Error("Cause error");
540
+ const error = new Error("Main error");
541
+ error.cause = cause;
542
+ captureServerError(error);
543
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
544
+ type: "server_error",
545
+ error: {
546
+ message: "Main error",
547
+ name: "Error",
548
+ stack: expect.any(String),
549
+ cause,
550
+ },
551
+ request: undefined,
552
+ context: undefined,
553
+ timestamp: expect.any(Number),
554
+ });
555
+ });
556
+ it("should handle null and undefined errors", () => {
557
+ captureServerError(null);
558
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
559
+ type: "server_error",
560
+ error: {
561
+ message: "null",
562
+ name: "UnknownError",
563
+ },
564
+ request: undefined,
565
+ context: undefined,
566
+ timestamp: expect.any(Number),
567
+ });
568
+ mockCapture.mockClear();
569
+ captureServerError(undefined);
570
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
571
+ type: "server_error",
572
+ error: {
573
+ message: "undefined",
574
+ name: "UnknownError",
575
+ },
576
+ request: undefined,
577
+ context: undefined,
578
+ timestamp: expect.any(Number),
579
+ });
580
+ });
581
+ it("should handle number errors", () => {
582
+ captureServerError(TEST_PORT);
583
+ expect(mockCapture).toHaveBeenCalledWith("server_error", {
584
+ type: "server_error",
585
+ error: {
586
+ message: String(TEST_PORT),
587
+ name: "UnknownError",
588
+ },
589
+ request: undefined,
590
+ context: undefined,
591
+ timestamp: expect.any(Number),
592
+ });
593
+ });
594
+ });
595
+ });
596
+ //# sourceMappingURL=error-handlers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handlers.test.js","sourceRoot":"","sources":["../../../../src/__tests__/lib/core/error-handlers.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAE7C,4BAA4B;AAC5B,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE5B,wBAAwB;AACxB,MAAM,cAAc,GAAG,aAAa,CAAC;AACrC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;CACtD,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,UAAU,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O,EAAE,MAAM;oBACf,IAAI,EAAE,cAAc;iBACrB;gBACD,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAC9B,CAAC,CAAC;YAEH,WAAW,CAAC,SAAS,EAAE,CAAC;YAExB,kBAAkB,CAAC,SAAS,CAAC,CAAC;YAC9B,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE;gBACvD,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE;oBACL,OAAO,EAAE,WAAW;oBACpB,IAAI,EAAE,cAAc;iBACrB;gBACD,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAC9B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YAC9B,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE;gBACvD,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC;oBAC1B,IAAI,EAAE,cAAc;iBACrB;gBACD,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,SAAS;gBAClB,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAC9B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=event-queue.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-queue.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/lib/core/event-queue.test.ts"],"names":[],"mappings":""}