fixed tests

This commit is contained in:
Luca Vazzano
2017-01-13 00:46:01 +01:00
parent 6de3e0630c
commit 861c2abc61
2 changed files with 51 additions and 44 deletions
+14 -14
View File
@@ -1,4 +1,4 @@
// Type definitions for Raven.js
// Type definitions for Raven.js
// Project: https://github.com/getsentry/raven-js
// Original Definitions by: Santi Albo <https://github.com/santialbo>, Benjamin Pannell
// <http://github.com/spartan563>; DefinitelyTyped
@@ -8,8 +8,8 @@
// <https://github.com/combmag>, Luca Vazzano <https://github.com/LucaVazz>
declare var Raven: RavenStatic;
export = Raven;
declare let Raven: RavenStatic;
export default Raven;
interface RavenStatic {
/** Raven.js version. */
@@ -43,7 +43,7 @@ interface RavenStatic {
*
* @param dsn The public Sentry DSN
*/
setDSN(dsn: string);
setDSN(dsn: string): RavenStatic;
/**
* Installs a global window.onerror error handler to capture and report uncaught exceptions.
@@ -200,7 +200,7 @@ interface RavenStatic {
// --- Helper Interfaces for Options --------------
interface RavenBreadcrumOptions {
export interface RavenBreadcrumOptions {
/** Whether to collect XHR calls, defaults to true */
xhr?: boolean;
@@ -214,7 +214,7 @@ interface RavenBreadcrumOptions {
location?: boolean;
}
interface CommonRavenOptions {
export interface CommonRavenOptions {
/** The environment of the application you are monitoring with Sentry */
environment?: string;
@@ -234,7 +234,7 @@ interface CommonRavenOptions {
stacktrace?: boolean;
}
interface RavenOptions extends CommonRavenOptions {
export interface RavenOptions extends CommonRavenOptions {
/** The name of the server or device that the client is running on */
server_name?: string;
@@ -253,7 +253,7 @@ interface RavenOptions extends CommonRavenOptions {
platform?: string;
}
interface RavenGlobalOptions extends CommonRavenOptions {
export interface RavenGlobalOptions extends CommonRavenOptions {
/** The name of the server or device that the client is running on */
serverName?: string;
@@ -294,12 +294,12 @@ interface RavenGlobalOptions extends CommonRavenOptions {
dataCallback?: (data: any) => any;
}
interface RavenWrapOptions extends RavenOptions {
export interface RavenWrapOptions extends RavenOptions {
/** Whether to run the wrap recursively. Default: false. */
deep?: boolean;
}
interface RavenTransportOptions {
export interface RavenTransportOptions {
url: string;
data: any;
auth: {
@@ -311,7 +311,7 @@ interface RavenTransportOptions {
onFailure: () => void;
}
interface RavenReportDialogOptions {
export interface RavenReportDialogOptions {
eventId?: number,
dsn?: string,
user?: {
@@ -322,11 +322,11 @@ interface RavenReportDialogOptions {
// --- Helper Interfaces for complex Data Structures --------------
interface RavenPlugin {
export interface RavenPlugin {
(raven: RavenStatic, ...args: any[]): RavenStatic;
}
interface RavenUserContext {
export interface RavenUserContext {
id?: string;
username?: string;
email?: string;
@@ -334,7 +334,7 @@ interface RavenUserContext {
extra?: { [prop: string]: any };
}
interface RavenBreadcrumb {
export interface RavenBreadcrumb {
message: string;
data: { [id: string]: string };
category: string;
+37 -30
View File
@@ -1,24 +1,24 @@
import RavenJS from 'raven-js';
RavenJS.config('https://public@getsentry.com/1').install();
var options: RavenOptions = {
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
};
Raven.config('https://public@getsentry.com/1', options).install();
RavenJS.config(
'https://public@getsentry.com/1',
{
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
}
).install();
var throwsError = () => {
throw new Error('broken');
@@ -27,28 +27,35 @@ var throwsError = () => {
try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
RavenJS.captureException(e);
RavenJS.captureException(e, {tags: { key: "value" }});
}
Raven.context(throwsError);
Raven.context({tags: { key: "value" }}, throwsError);
Raven.context({extra: {planet: {name: 'Earth'}}}, throwsError);
RavenJS.context(throwsError);
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);
setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
Raven.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();
setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();
Raven.setUserContext({
RavenJS.setUserContext({
email: 'matt@example.com',
id: '123'
});
Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});
Raven.showReportDialog(options);
RavenJS.showReportDialog({
eventId: 0815,
dsn:'1337asdf',
user: {
name: 'DefenitelyTyped',
email: 'df@ts.ms'
}
});
Raven.setTagsContext({ key: "value" });
RavenJS.setTagsContext({ key: "value" });
Raven.setExtraContext({ foo: "bar" });
RavenJS.setExtraContext({ foo: "bar" });