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" ;
76
87function BaseTestError ( ) {
98 this . name = "NotImplementedError" ;
@@ -18,8 +17,8 @@ function DerivedTestError() {
1817
1918DerivedTestError . prototype = new BaseTestError ( ) ;
2019
21- describe ( "ErrorPlugin " , ( ) => {
22- const target = new ErrorPlugin ( ) ;
20+ describe ( "BrowserErrorPlugin " , ( ) => {
21+ const target = new BrowserErrorPlugin ( ) ;
2322 let context : EventPluginContext ;
2423
2524 beforeEach ( ( ) => {
@@ -110,3 +109,21 @@ function throwAndCatch(error: any): Error {
110109 return exception ;
111110 }
112111}
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