Skip to content

tests: fix inspector uri-encoded paths - #59991

Open
kapouer wants to merge 1 commit into
nodejs:mainfrom
kapouer:main
Open

tests: fix inspector uri-encoded paths#59991
kapouer wants to merge 1 commit into
nodejs:mainfrom
kapouer:main

Conversation

@kapouer

Copy link
Copy Markdown
Contributor

This fixes#59803

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 23, 2025
@kapouer

Copy link
Copy Markdown
ContributorAuthor

However I see that https://github.com/nodejs/node/actions/runs/17947125836/job/51036256456
there is already a job that tests this situation, and this PR broke it.

So it's weird that it did fail previously.
I can't believe this is only because I chose the path to contain a tilde and not any other character ?!?

@codecov

codecovBot commented Sep 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.44%. Comparing base (24ded11) to head (9b67c1f).
⚠️ Report is 2494 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #59991 +/- ##
==========================================
- Coverage 88.45% 88.44% -0.02% 
==========================================
Files 703 703 Lines 207544 207544 Branches 40013 40016 +3 ==========================================
- Hits 183587 183563 -24 + Misses 15965 15955 -10 - Partials 7992 8026 +34 

see 45 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

session.post('Debugger.setBreakpointByUrl', {
'lineNumber': 22,
'url': pathToFileURL(path.resolve(__dirname, __filename)).toString(),
'url': decodeURIComponent(pathToFileURL(path.resolve(__dirname, __filename)).toString()),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is correct. The field url has to be a string in correct URL format.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I agree - I totally failed to fix this. I spent hours on this trying to find the root cause, no success.
My plan is to ignore that bug :(

@cola119cola119Oct 30, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@legendecas It seems that the inspector server can't resolve the file and fails to set breakpoints when the url has encoded values. Decoding the url by the client looks a valid workaround to me. What do you think?

Decoded URL

[inspector received] {"id":3,"method":"Debugger.setBreakpointByUrl","params":{"lineNumber":18,"url":"file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread~.js","columnNumber":0,"condition":""}}
[inspector send] {"id":3,"result":{"breakpointId":"1:18:0:file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread~.js","locations":[{"scriptId":"76","lineNumber":18,"columnNumber":8}]}}

Encoded URL

[inspector received] {"id":3,"method":"Debugger.setBreakpointByUrl","params":{"lineNumber":18,"url":"file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread%7E.js","columnNumber":0,"condition":""}}
[inspector send] {"id":3,"result":{"breakpointId":"1:18:0:file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread%7E.js","locations":[]}}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Note that there is already logic implemented to percent-encode special characters.
It's even tested by one of node's CI.
However, it fails for ~ (and + maybe), and this PR means nothing until it understands why.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that there is already logic implemented to percent-encode special characters.

Can you point it out?

@kapouerkapouerOct 30, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

No ! I only know there is a test about it, and that test doesn't include ~ + chars

- name: Re-run test in a folder whose name contains unusual chars
run: |
mv node "$DIR"
cd "$DIR"
./tools/test.py --flaky-tests keep_retrying -p actions -j 4
env:
DIR: dir%20with $unusual"chars?'åß∂ƒ©∆¬…`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's an interesting point. The filename including ? can work fine.

[inspector received] {"id":3,"method":"Debugger.setBreakpointByUrl","params":{"lineNumber":18,"url":"file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread%3F.js","columnNumber":0,"condition":""}}
[inspector send] {"id":3,"result":{"breakpointId":"1:18:0:file:///Users/kohei/Documents/node/test/parallel/test-inspector-connect-main-thread%3F.js","locations":[{"scriptId":"76","lineNumber":18,"columnNumber":8}]}}

@cola119cola119 added the inspector Issues and PRs related to the V8 inspector protocol label Oct 30, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inspectorIssues and PRs related to the V8 inspector protocolneeds-ciPRs that need a full CI run.staletestIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspector tests fail when current path has encoded characters (like ~)

4 participants

@kapouer@legendecas@cola119@nodejs-github-bot