Update windows paths to include file:// and fix tests. (mathjax/MathJax#3481).#1404
Update windows paths to include file:// and fix tests. (mathjax/MathJax#3481).#1404
Conversation
zorkow
left a comment
There was a problem hiding this comment.
I am getting tests errors. But maybe I am running it wrong on Windows.
| ? file.replace(/\\/g, '/').replace(/^\//, '') | ||
| : file; | ||
| ? 'file://' + file.replace(/\\/g, '/').replace(/^\//, '') | ||
| : file.replace(/^\//, 'file:///'); |
There was a problem hiding this comment.
This now leads to an error in Context-node.test.ts:
Received: "file:///C:/test.js"
There was a problem hiding this comment.
OK, I forgot about this test (I didn't run it on windows, and that test is only performed there).
I fixed the test. I had to merge your fix/windows-tests branch to get the tests to run on windows, but that is still listed as a draft PR. Do you want to make it a full PR so we can include it in 4.1.1?
|
I've approved, but please remove that superfluous |
|
OOPS! Made the changes in my Windows VM, but didn't copy them correctly to my development repository. Fixed now. |
|
Argh! This was merged to |
In Windows, importing a file from an absolute path requires the path to include the
file://protocol (that is not needed in unix and MacOS). This PR modifies thecontext.path()function that adjusts the Windows\to/to also add the neededfile://protocol for absolute references. It also adds tests to get full coverage of the changes. Finally, it adjusts theasyncLoad/system.tsfile to includefile://(though thesystem.tsfile is a legacy one that isn't really used any longer since node handles ESM loading natively).Resolves issue mathjax/MathJax#3481.