This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
forked from zivl/sentry-testkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
74 lines (64 loc) · 1.8 KB
/
index.d.ts
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Event, Breadcrumb, User, Severity, StackFrame, Transport, TransportOptions } from '@sentry/types';
export = sentryTestkit;
declare function sentryTestkit(): sentryTestkit.TestkitResult;
declare namespace sentryTestkit {
interface Page {
on(event: string, handler: (...args: any[]) => any): void;
removeListener(event: string, handler: (...args: any[]) => any): void;
}
interface ReportError {
name: string
message: string
stacktrace: StackFrame[]
}
interface Report {
breadcrumbs: Breadcrumb[]
error?: ReportError
message?: string
extra?: { [key: string]: any }
level: Severity
release?: string
user?: User
tags: { [key: string]: string }
originalReport: Event
}
interface Span {
id: string
op?: string
description?: string
parentSpanId: string
}
interface Transaction {
name: string
traceId: string
release?: string
extra?: Record<string, unknown>
tags: Record<string, unknown>
spans: Span[]
}
export interface Testkit {
puppeteer: {
startListening(page: Page, baseUrl?: String): void;
stopListening(page: Page): void;
};
reports(): Report[];
transactions(): Transaction[];
reset(): void;
getExceptionAt(index: number): ReportError;
findReport(e: Error): Report;
isExist(e: Error): boolean;
}
export interface LocalServer {
start: (dsn: string) => Promise<void>;
stop: () => Promise<void>;
getDsn: () => string;
}
export interface TestkitResult {
testkit: Testkit;
sentryTransport: {
new (options: TransportOptions): Transport;
};
initNetworkInterceptor<T>(dsn: string, initCallback: (baseUrl: string, handleRequestBody: (requestBody: { [key: string]: any }) => void) => T): T;
localServer: LocalServer
}
}