Skip to content

Commit f9996b4

Browse files
committed
Fixed unit tests and naming conventions.
1 parent a07aca9 commit f9996b4

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed
File renamed without changes.

node-stack-trace/node-stack-trace.d.ts stack-trace/stack-trace.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Type definitions for node-stack-trace
22
// Project: https://github.com/felixge/node-stack-trace
3-
// Definitions by: [Exceptionless] <https://github.com/exceptionless>
3+
// Definitions by: Exceptionless <https://github.com/exceptionless>
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
55

66
declare module 'stack-trace' {
@@ -15,6 +15,6 @@ declare module 'stack-trace' {
1515
isNative():boolean;
1616
}
1717

18-
export function get(belowFn:() => void): StackFrame[];
18+
export function get(belowFn?:() => void): StackFrame[];
1919
export function parse(err:Error): StackFrame[];
2020
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import StackTrace = require('StackTrace');
1+
/// <reference path="stacktrace-js.d.ts" />
22

33
function interestingFn() {
44
return 'https://github.com/exceptionless/Exceptionless';
55
}
66

7-
var callback = function(stackframes) {
8-
var stringifiedStack = stackframes.map(function(sf) {
7+
var callback = function(stackframes:StackTrace.StackFrame[]) {
8+
var stringifiedStack = stackframes.map(function(sf:StackTrace.StackFrame) {
99
return sf.toString();
1010
}).join('\n');
1111
console.log(stringifiedStack);
1212
};
1313

14-
var errback = function(err) { console.log(err.message); };
15-
14+
var errorCallback = function(err:Error) { console.log(err.message); };
1615

1716
StackTrace.get();
1817

@@ -21,5 +20,5 @@ var error = new Error('BOOM!');
2120
StackTrace.fromError(error);
2221
StackTrace.generateArtificially();
2322

24-
StackTrace.instrument(interestingFn, callback, errback);
23+
StackTrace.instrument(interestingFn, callback, errorCallback);
2524
StackTrace.deinstrument(interestingFn);

stacktrace/stacktrace.d.ts stacktrace-js/stacktrace-js.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ declare module StackTrace {
1313
}
1414

1515
export interface StackFrame {
16-
constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number);
16+
constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number): StackFrame;
1717

1818
functionName?:string;
1919
args?:any;
@@ -28,7 +28,7 @@ declare module StackTrace {
2828
* @param options Options Object
2929
* @return Array[StackFrame]
3030
*/
31-
export function get(options: StackTraceOptions): Promise<StackFrame[]>;
31+
export function get(options?: StackTraceOptions): Promise<StackFrame[]>;
3232

3333
/**
3434
* Given an error object, parse it.
@@ -43,7 +43,7 @@ declare module StackTrace {
4343
* @param options Object options
4444
* @returns Array[StackFrame]
4545
*/
46-
export function generateArtificially(options: StackTraceOptions): Promise<StackFrame[]>;
46+
export function generateArtificially(options?: StackTraceOptions): Promise<StackFrame[]>;
4747

4848
/**
4949
* Given a function, wrap it such that invocations trigger a callback that
@@ -54,7 +54,7 @@ declare module StackTrace {
5454
* @param {Function} errorCallback optional function to call with error if unable to get stack trace.
5555
* @param {Object} thisArg optional context object (e.g. window)
5656
*/
57-
export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void;
57+
export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:(error:Error) => void, thisArg?:any): void;
5858

5959
/**
6060
* Given a function that has been instrumented,

0 commit comments

Comments
 (0)