1+ // jscs:disable maximumLineLength
12/* global Errors: false */
2- describe ( 'StackTrace' , function ( ) {
3+ describe ( 'StackTrace' , function ( ) {
34
4- beforeEach ( function ( ) {
5+ beforeEach ( function ( ) {
56 if ( typeof Promise === 'undefined' ) {
67 ES6Promise . polyfill ( ) ;
78 }
89 } ) ;
910
10- describe ( '#get' , function ( ) {
11+ describe ( '#get' , function ( ) {
1112 it ( 'gets stacktrace from current location' , function testStackTraceGet ( done ) {
1213 StackTrace . get ( ) . then ( callback , done . fail ) [ 'catch' ] ( done . fail ) ;
1314
@@ -18,20 +19,20 @@ describe('StackTrace', function () {
1819 } ) ;
1920 } ) ;
2021
21- describe ( '#fromError' , function ( ) {
22+ describe ( '#fromError' , function ( ) {
2223 beforeEach ( function ( ) {
2324 jasmine . Ajax . install ( ) ;
2425 } ) ;
2526 afterEach ( function ( ) {
2627 jasmine . Ajax . uninstall ( ) ;
2728 } ) ;
2829
29- it ( 'rejects with Error given unparsable Error object' , function ( done ) {
30+ it ( 'rejects with Error given unparsable Error object' , function ( done ) {
3031 StackTrace . fromError ( { message : 'ERROR_MESSAGE' } )
3132 . then ( done . fail ) [ 'catch' ] ( done ) ;
3233 } ) ;
3334
34- it ( 'parses stacktrace from given Error object' , function ( done ) {
35+ it ( 'parses stacktrace from given Error object' , function ( done ) {
3536 jasmine . Ajax . stubRequest ( 'http://path/to/file.js' ) . andError ( ) ;
3637
3738 StackTrace . fromError ( Errors . IE_11 )
@@ -44,7 +45,7 @@ describe('StackTrace', function () {
4445 }
4546 } ) ;
4647
47- it ( 'filters returned stack' , function ( done ) {
48+ it ( 'filters returned stack' , function ( done ) {
4849 function onlyFoos ( stackFrame ) {
4950 return stackFrame . functionName === 'foo' ;
5051 }
@@ -62,7 +63,7 @@ describe('StackTrace', function () {
6263 }
6364 } ) ;
6465
65- it ( 'uses source maps to enhance stack frames' , function ( done ) {
66+ it ( 'uses source maps to enhance stack frames' , function ( done ) {
6667 var sourceCache = {
6768 'http://path/to/file.js' : 'function increment(){\nsomeVariable+=2;\nnull.x()\n}\nvar someVariable=2;increment();' ,
6869 'http://path/to/file.min.js' : 'function increment(){someVariable+=2;null.x()}var someVariable=2;increment();\n//# sourceMappingURL=file.min.js.map' ,
@@ -81,9 +82,9 @@ describe('StackTrace', function () {
8182 } ) ;
8283 } ) ;
8384
84- describe ( '#generateArtificially' , function ( ) {
85- it ( 'gets stacktrace from current location' , function ( done ) {
86- var stackFrameFilter = function ( stackFrame ) {
85+ describe ( '#generateArtificially' , function ( ) {
86+ it ( 'gets stacktrace from current location' , function ( done ) {
87+ var stackFrameFilter = function ( stackFrame ) {
8788 return stackFrame . getFunctionName ( ) &&
8889 stackFrame . getFunctionName ( ) . indexOf ( 'testGenerateArtificially' ) > - 1 ;
8990 } ;
@@ -100,14 +101,19 @@ describe('StackTrace', function () {
100101 } ) ;
101102 } ) ;
102103
103- describe ( '#instrument' , function ( ) {
104+ describe ( '#instrument' , function ( ) {
104105 it ( 'throws Error given non-function input' , function ( ) {
105- expect ( function ( ) { StackTrace . instrument ( 'BOGUS' ) ; } )
106+ expect ( function ( ) {
107+ StackTrace . instrument ( 'BOGUS' ) ;
108+ } )
106109 . toThrow ( new Error ( 'Cannot instrument non-function object' ) ) ;
107110 } ) ;
108111
109112 it ( 'wraps given function and calls given callback when called' , function ( done ) {
110- function interestingFn ( ) { return 'something' ; }
113+ function interestingFn ( ) {
114+ return 'something' ;
115+ }
116+
111117 var wrapped = StackTrace . instrument ( interestingFn , callback , done . fail ) ;
112118 expect ( wrapped ( ) ) . toBe ( 'something' ) ;
113119
@@ -120,11 +126,16 @@ describe('StackTrace', function () {
120126 } ) ;
121127
122128 it ( 'calls callback with stack trace when wrapped function throws an Error' , function ( done ) {
123- function interestingFn ( ) { throw new Error ( 'BOOM' ) ; }
129+ function interestingFn ( ) {
130+ throw new Error ( 'BOOM' ) ;
131+ }
132+
124133 var wrapped = StackTrace . instrument ( interestingFn , callback , done . fail ) ;
125134
126135 // Exception should be re-thrown from instrument
127- expect ( function ( ) { wrapped ( ) ; } ) . toThrow ( new Error ( 'BOOM' ) ) ;
136+ expect ( function ( ) {
137+ wrapped ( ) ;
138+ } ) . toThrow ( new Error ( 'BOOM' ) ) ;
128139
129140 function callback ( stackFrames ) {
130141 if ( stackFrames [ 0 ] . fileName ) { // Work around IE9-
@@ -135,26 +146,35 @@ describe('StackTrace', function () {
135146 } ) ;
136147
137148 it ( 'does not re-instrument already instrumented function' , function ( ) {
138- function interestingFn ( ) { return 'something' ; }
149+ function interestingFn ( ) {
150+ return 'something' ;
151+ }
152+
139153 var wrapped = StackTrace . instrument ( interestingFn ) ;
140154 expect ( StackTrace . instrument ( wrapped ) ) . toEqual ( wrapped ) ;
141155 } ) ;
142156 } ) ;
143157
144- describe ( '#deinstrument' , function ( ) {
145- it ( 'throws Error given non-function input' , function ( ) {
146- expect ( function ( ) {
158+ describe ( '#deinstrument' , function ( ) {
159+ it ( 'throws Error given non-function input' , function ( ) {
160+ expect ( function ( ) {
147161 StackTrace . deinstrument ( 'BOGUS' ) ;
148162 } ) . toThrow ( new Error ( 'Cannot de-instrument non-function object' ) ) ;
149163 } ) ;
150164
151165 it ( 'given unwrapped input, returns input' , function ( ) {
152- function interestingFn ( ) { return 'something' ; }
166+ function interestingFn ( ) {
167+ return 'something' ;
168+ }
169+
153170 expect ( StackTrace . deinstrument ( interestingFn ) ) . toEqual ( interestingFn ) ;
154171 } ) ;
155172
156173 it ( 'de-instruments instrumented function' , function ( ) {
157- function interestingFn ( ) { return 'something' ; }
174+ function interestingFn ( ) {
175+ return 'something' ;
176+ }
177+
158178 var wrapped = StackTrace . instrument ( interestingFn ) ;
159179 expect ( wrapped . __stacktraceOriginalFn ) . toEqual ( interestingFn ) ;
160180
@@ -164,15 +184,15 @@ describe('StackTrace', function () {
164184 } ) ;
165185 } ) ;
166186
167- describe ( '#report' , function ( ) {
187+ describe ( '#report' , function ( ) {
168188 beforeEach ( function ( ) {
169189 jasmine . Ajax . install ( ) ;
170190 } ) ;
171191 afterEach ( function ( ) {
172192 jasmine . Ajax . uninstall ( ) ;
173193 } ) ;
174194
175- it ( 'sends POST request to given URL' , function ( done ) {
195+ it ( 'sends POST request to given URL' , function ( done ) {
176196 var url = 'http://domain.ext/endpoint' ;
177197 var stackframes = [ new StackFrame ( 'fn' , undefined , 'file.js' , 32 , 1 ) ] ;
178198
@@ -189,7 +209,7 @@ describe('StackTrace', function () {
189209 }
190210 } ) ;
191211
192- it ( 'rejects if POST request fails' , function ( done ) {
212+ it ( 'rejects if POST request fails' , function ( done ) {
193213 var url = 'http://domain.ext/endpoint' ;
194214 var stackframes = [ new StackFrame ( 'fn' , undefined , 'file.js' , 32 , 1 ) ] ;
195215
0 commit comments