@@ -45,7 +45,7 @@ module.exports = (pkg) => {
4545 }
4646
4747 function tearDown ( t ) {
48- t . context ? .server ? .close ( )
48+ t . context . server . close ( )
4949 helper . unloadAgent ( t . context . agent )
5050 }
5151
@@ -148,22 +148,18 @@ module.exports = (pkg) => {
148148
149149 t . test ( 'should name and produce segments for matched wildcard path' , ( t ) => {
150150 const { agent, router, app } = t . context
151- let path = '(.*)'
152- if ( semver . gte ( pkgVersion , '13.0.1' ) ) {
153- path = '{*any}'
154- }
155- router . get ( `/:first/${ path } ` , function firstMiddleware ( ctx ) {
151+ router . get ( '/:first/(.*)' , function firstMiddleware ( ctx ) {
156152 ctx . body = 'first'
157153 } )
158154 app . use ( router . routes ( ) )
159155 agent . on ( 'transactionFinished' , ( tx ) => {
160156 t . assertSegments ( tx . trace . root , [
161- ` WebTransaction/WebFrameworkUri/Koa/GET//:first/${ path } ` ,
162- [ 'Koa/Router: /' , [ ` Nodejs/Middleware/Koa/firstMiddleware//:first/${ path } ` ] ]
157+ ' WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)' ,
158+ [ 'Koa/Router: /' , [ ' Nodejs/Middleware/Koa/firstMiddleware//:first/(.*)' ] ]
163159 ] )
164160 t . equal (
165161 tx . name ,
166- ` WebTransaction/WebFrameworkUri/Koa/GET//:first/${ path } ` ,
162+ ' WebTransaction/WebFrameworkUri/Koa/GET//:first/(.*)' ,
167163 'transaction should be named after the matched regex path'
168164 )
169165 t . end ( )
@@ -346,21 +342,20 @@ module.exports = (pkg) => {
346342 router . get ( '/:second' , function terminalMiddleware ( ctx ) {
347343 ctx . body = ' second'
348344 } )
349-
350- const segmentTree = semver . gte ( pkgVersion , '13.0.1' )
351- ? [ 'Nodejs/Middleware/Koa/terminalMiddleware//:second' ]
352- : [
353- 'Nodejs/Middleware/Koa/secondMiddleware//:first' ,
354- [
355- 'Nodejs/Middleware/Koa/secondMiddleware//:second' ,
356- [ 'Nodejs/Middleware/Koa/terminalMiddleware//:second' ]
357- ]
358- ]
359345 app . use ( router . routes ( ) )
360346 agent . on ( 'transactionFinished' , ( tx ) => {
361347 t . assertSegments ( tx . trace . root , [
362348 'WebTransaction/WebFrameworkUri/Koa/GET//:second' ,
363- [ 'Koa/Router: /' , segmentTree ]
349+ [
350+ 'Koa/Router: /' ,
351+ [
352+ 'Nodejs/Middleware/Koa/secondMiddleware//:first' ,
353+ [
354+ 'Nodejs/Middleware/Koa/secondMiddleware//:second' ,
355+ [ 'Nodejs/Middleware/Koa/terminalMiddleware//:second' ]
356+ ]
357+ ]
358+ ]
364359 ] )
365360 t . equal (
366361 tx . name ,
0 commit comments