Skip to content

Commit

Permalink
Revert "test: Fixed @koa/router tests. path-to-regex differs between …
Browse files Browse the repository at this point in the history
…@koa/router and koa-router now (newrelic#2587)"

This reverts commit 902c2bf.
  • Loading branch information
sumitsuthar authored Sep 20, 2024
1 parent 58d0487 commit 79473e5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions test/versioned/koa/router-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ module.exports = (pkg) => {
t.test('should name and produce segments for matched wildcard path', (t) => {
const { agent, router, app } = t.context
let path = '(.*)'
if (pkg === 'koa-router' && semver.gte(pkgVersion, '13.0.1')) {
if (semver.gte(pkgVersion, '13.0.1')) {
path = '{*any}'
}
router.get(`/:first/${path}`, function firstMiddleware(ctx) {
Expand Down Expand Up @@ -347,16 +347,15 @@ module.exports = (pkg) => {
ctx.body = ' second'
})

const segmentTree =
pkg === 'koa-router' && semver.gte(pkgVersion, '13.0.1')
? ['Nodejs/Middleware/Koa/terminalMiddleware//:second']
: [
'Nodejs/Middleware/Koa/secondMiddleware//:first',
[
'Nodejs/Middleware/Koa/secondMiddleware//:second',
['Nodejs/Middleware/Koa/terminalMiddleware//:second']
]
const segmentTree = semver.gte(pkgVersion, '13.0.1')
? ['Nodejs/Middleware/Koa/terminalMiddleware//:second']
: [
'Nodejs/Middleware/Koa/secondMiddleware//:first',
[
'Nodejs/Middleware/Koa/secondMiddleware//:second',
['Nodejs/Middleware/Koa/terminalMiddleware//:second']
]
]
app.use(router.routes())
agent.on('transactionFinished', (tx) => {
t.assertSegments(tx.trace.root, [
Expand Down

0 comments on commit 79473e5

Please sign in to comment.