Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Updated how we handle the koa-router nuance of wildcard routes #2588

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

bizob2828
Copy link
Member

@bizob2828 bizob2828 commented Sep 18, 2024

Description

Both koa-rotuer and @koa/router 13.0.1 use path-to-regexp@8 but @koa/router released 13.1.0 and downgraded path-to-regexp@6. This PR updates how we determined how to defined wildcard routes by keying off the version of path-to-regexp when present. If it is not present assume the legacy behavior.

How to test

npm run versioned:internal koa
===============================================================
 ✓ koa (100) 3m
===============================================================
Versions executed

Folder: koa
	 * koa(5): 2.0.1, 2.4.1, 2.8.2, 2.12.1, 2.15.3
	 * koa-router(3): 11.0.2, 12.0.1, 13.0.1
	 * @koa/router(4): 11.0.2, 12.0.2, 13.0.1, 13.1.0
	 * koa-route(4): 3.0.0, 3.1.0, 3.2.0, 4.0.1
===============================================================
PASS

I suspect they remedy this version mismatch of path-to-regexp between 13.0.1 and 13.1.0. I filed an issue here

@bizob2828 bizob2828 added the dev:tests Indicates only changes to tests label Sep 18, 2024
@bizob2828 bizob2828 merged commit ddeb097 into newrelic:main Sep 18, 2024
32 checks passed
@bizob2828 bizob2828 deleted the fix-koa-router-pt-3 branch September 18, 2024 20:51
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.18%. Comparing base (a5a1526) to head (5e76245).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2588      +/-   ##
==========================================
- Coverage   97.23%   97.18%   -0.05%     
==========================================
  Files         291      291              
  Lines       45932    45932              
==========================================
- Hits        44661    44639      -22     
- Misses       1271     1293      +22     
Flag Coverage Δ
integration-tests-cjs-18.x 74.19% <ø> (ø)
integration-tests-cjs-20.x 74.19% <ø> (ø)
integration-tests-cjs-22.x 74.23% <ø> (+<0.01%) ⬆️
integration-tests-esm-18.x 49.69% <ø> (ø)
integration-tests-esm-20.x 49.69% <ø> (ø)
integration-tests-esm-22.x 49.72% <ø> (ø)
unit-tests-18.x 88.88% <ø> (ø)
unit-tests-20.x 88.88% <ø> (ø)
unit-tests-22.x 88.89% <ø> (ø)
versioned-tests-18.x 78.95% <ø> (-0.19%) ⬇️
versioned-tests-20.x 78.99% <ø> (-0.16%) ⬇️
versioned-tests-22.x 78.97% <ø> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +17 to +27
function getPathToRegexpVersion() {
let pathToRegexVersion
try {
;({ version: pathToRegexVersion } = JSON.parse(
fs.readFileSync(`${__dirname}/node_modules/path-to-regexp/package.json`)
))
} catch {
pathToRegexVersion = '6.0.0'
}
return pathToRegexVersion
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely ridiculous that this is necessary.

sumitsuthar pushed a commit to k2io/fork-node-newrelic that referenced this pull request Sep 20, 2024
sumitsuthar added a commit to k2io/fork-node-newrelic that referenced this pull request Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:tests Indicates only changes to tests
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

3 participants