forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventPluginTestFixture.ts
More file actions
30 lines (27 loc) · 1.03 KB
/
EventPluginTestFixture.ts
File metadata and controls
30 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { ContextData } from "../../../src/plugins/ContextData.js";
import { EventPluginContext } from "../../../src/plugins/EventPluginContext.js";
import { IErrorParser } from "../../../src/services/IErrorParser.js";
import { Event } from "../../../src/models/Event.js";
import { ExceptionlessClient } from "../../../src/ExceptionlessClient.js";
export function createFixture(): { contextData: ContextData, context: EventPluginContext, client: any, event: Event } {
const errorParser: IErrorParser = {
parse: (c: EventPluginContext, exception: Error) => Promise.resolve({
type: exception.name,
message: exception.message,
stack_trace: null
})
};
const client: ExceptionlessClient = new ExceptionlessClient();
client.config.services.errorParser = errorParser;
const event: Event = {
data: {}
};
const contextData: ContextData = new ContextData();
const context: EventPluginContext = new EventPluginContext(client, event, contextData);
return {
contextData,
context,
client,
event
};
}