erisu commented on PR #126:
URL: https://github.com/apache/cordova-fetch/pull/126#issuecomment-3170404812

   > At first I tried to use node default library url.pathToFileURL() but it 
causes error in windows because url.pathToFileURL() also converts unnecessary 
URL encoding.
   
   Can you explain the issues you saw?
   
   I tried testing with `pathToFileURL` and it was working. I ran my tests 
locally (macOS) and in GH Actions to confirm on Windows & Linux.
   
   I think its OK to use `pathToFileURL` since we are only updating test code.
   
   I made the following changes based on your current work:
   
   Add to top below requiring `fs`:
   
   ```js
   const { pathToFileURL } = require('node:url');
   ```
   
   In test `should return package path if git repo name differs from plugin id` 
replace line:
   ```js
   const TARGET = `git+file://${path.resolve(__dirname, 
'support/repo-name-neq-plugin-id.git')}`;
   ```
   with:
   ```js
   const TARGET = `git+${pathToFileURL(path.resolve(__dirname, 
'support/repo-name-neq-plugin-id.git'))}`;
   ```
   
   In the `beforeEach` block of `fetching with node_modules in ancestor dirs`, 
replace line:
   ```js
   fetchTarget = `file://${path.resolve('support/dummy-local-plugin')}`;
   ```
   with:
   ```js
   fetchTarget = pathToFileURL(path.resolve('support/dummy-local-plugin')).href;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to