@@ -89,6 +89,35 @@ describe("Span", () => {
89
89
} )
90
90
} )
91
91
92
+ it ( "cleans Chrome-style backtraces with spaces in the path" , ( ) => {
93
+ const error = new Error ( "test error" )
94
+ error . stack = [
95
+ "Error: test error" ,
96
+ " at Foo (http://localhost:8080/assets with space/app/bundle.js:13:10)" ,
97
+ " at Bar (http://localhost:8080/assets with space/app/bundle.js:17:10)" ,
98
+ " at track (http://thirdparty.app/script.js:1:530)" ,
99
+ " at http://localhost:8080/assets with space/app/bundle.js:21:10"
100
+ ] . join ( "\n" )
101
+
102
+ span . setError ( error )
103
+ span . cleanBacktracePath (
104
+ [ new RegExp ( "/assets with space/(app/.*)$" ) ] . map ( toBacktraceMatcher )
105
+ )
106
+
107
+ const backtrace = span . serialize ( ) . error . backtrace
108
+ expect ( backtrace ) . toEqual ( [
109
+ "Error: test error" ,
110
+ " at Foo (app/bundle.js:13:10)" ,
111
+ " at Bar (app/bundle.js:17:10)" ,
112
+ " at track (http://thirdparty.app/script.js:1:530)" ,
113
+ " at app/bundle.js:21:10"
114
+ ] )
115
+
116
+ expect ( span . serialize ( ) . environment ) . toMatchObject ( {
117
+ backtrace_paths_matched : "3"
118
+ } )
119
+ } )
120
+
92
121
it ( "cleans Safari/FF-style backtraces" , ( ) => {
93
122
const error = new Error ( "test error" )
94
123
error . stack = [
@@ -116,6 +145,33 @@ describe("Span", () => {
116
145
} )
117
146
} )
118
147
148
+ it ( "cleans Safari/FF-style backtraces with spaces in the path" , ( ) => {
149
+ const error = new Error ( "test error" )
150
+ error . stack = [
151
+ "Foo@http://localhost:8080/assets with space/app/bundle.js:13:10" ,
152
+ "Bar@http://localhost:8080/assets with space/app/bundle.js:17:10" ,
153
+ "track@http://thirdparty.app/script.js:1:530" ,
154
+ "@http://localhost:8080/assets with space/app/bundle.js:21:10"
155
+ ] . join ( "\n" )
156
+
157
+ span . setError ( error )
158
+ span . cleanBacktracePath (
159
+ [ new RegExp ( "/assets with space/(app/.*)$" ) ] . map ( toBacktraceMatcher )
160
+ )
161
+
162
+ const backtrace = span . serialize ( ) . error . backtrace
163
+ expect ( backtrace ) . toEqual ( [
164
+ "Foo@app/bundle.js:13:10" ,
165
+ "Bar@app/bundle.js:17:10" ,
166
+ "track@http://thirdparty.app/script.js:1:530" ,
167
+ "@app/bundle.js:21:10"
168
+ ] )
169
+
170
+ expect ( span . serialize ( ) . environment ) . toMatchObject ( {
171
+ backtrace_paths_matched : "3"
172
+ } )
173
+ } )
174
+
119
175
it ( "concatenates all match groups" , ( ) => {
120
176
const error = new Error ( "test error" )
121
177
error . stack = [
0 commit comments