1
- import { ErrorPlugin } from "../../../src/plugins/default/ErrorPlugin.js" ;
2
- import { EventPluginContext } from "../../../src/plugins/EventPluginContext.js" ;
3
- import { Event , KnownEventDataKeys } from "../../../src/models/Event.js" ;
4
- import { CapturedExceptions } from "./exceptions.js" ;
5
- import { createFixture } from "./EventPluginTestFixture.js" ;
6
- import { ErrorInfo } from "../../../src/models/data/ErrorInfo.js" ;
1
+ import { BrowserErrorPlugin } from "../../src/plugins/BrowserErrorPlugin.js" ;
2
+ import { EventPluginContext } from "./../../../core/src/plugins/EventPluginContext.js" ;
3
+ import { Event , KnownEventDataKeys } from "./../../../core/src/models/Event.js" ;
4
+ import { CapturedExceptions } from "./../../../core/test/plugins/default/exceptions.js" ;
5
+ import { ErrorInfo } from "./../../../core/src/models/data/ErrorInfo.js" ;
7
6
8
7
function BaseTestError ( ) {
9
8
this . name = "NotImplementedError" ;
@@ -18,8 +17,8 @@ function DerivedTestError() {
18
17
19
18
DerivedTestError . prototype = new BaseTestError ( ) ;
20
19
21
- describe ( "ErrorPlugin " , ( ) => {
22
- const target = new ErrorPlugin ( ) ;
20
+ describe ( "BrowserErrorPlugin " , ( ) => {
21
+ const target = new BrowserErrorPlugin ( ) ;
23
22
let context : EventPluginContext ;
24
23
25
24
beforeEach ( ( ) => {
@@ -110,3 +109,21 @@ function throwAndCatch(error: any): Error {
110
109
return exception ;
111
110
}
112
111
}
112
+
113
+ function createFixture ( ) : EventPluginContext {
114
+ const errorParser : IErrorParser = {
115
+ parse : ( c : EventPluginContext , exception : Error ) => Promise . resolve ( {
116
+ type : exception . name ,
117
+ message : exception . message ,
118
+ stack_trace : null
119
+ } )
120
+ } ;
121
+ const client : ExceptionlessClient = new ExceptionlessClient ( ) ;
122
+ client . config . services . errorParser = errorParser ;
123
+
124
+ const event : Event = {
125
+ data : { }
126
+ } ;
127
+
128
+ return new EventPluginContext ( client , event ) ;
129
+ }
0 commit comments